【问题标题】:cqlsh no viable alternative at input ':'cqlsh 在输入 ':' 处没有可行的替代方案
【发布时间】:2019-05-21 07:32:30
【问题描述】:

你好,我需要从詹金斯远程正确执行这个命令

ssh -T -i /home/jenkins-brs/.ssh/id_rsa cassandra@myhost 'sh /var/cassandra/bin/cqlsh -e "ALTER KEYSPACE system_auth WITH REPLICATION = {'class' : 'NetworkTopologyStrategy', 'DC1' : 2, 'DC2' : 2};"'

但我有这个错误:

<stdin>:1:SyntaxException: line 1:47 no viable alternative at input ':' (... system_auth WITH REPLICATION = {[class] :...)

这是我对 cassandra 表的期望:

system_auth | True | {'DC1': '2', 'DC2': '2', 'class': 'org.apache.cassandra.locator.NetworkTopologyStrategy'}

【问题讨论】:

    标签: cassandra cqlsh


    【解决方案1】:

    错误与您粘贴的命令不匹配。从错误来看,你有class 而不是'class'。

    [with update] ssh 对你的 shell 命令使用单引号,看起来原因是在 WITH REPLICATION = { 之后结束查询的一些转义问题。如果您使用双引号,则可以使用反斜杠转义 cqlsh arg 中的那些。

    【讨论】:

    • 您好,我对我的问题进行了一些更改...这是由 ' ' inside ' ' 引起的问题
    • 最后我用了:ssh -T -i /home/jenkins-brs/.ssh/id_rsa cassandra@myhost 'sh /var/cassandra/bin/cqlsh -f command.cql'
    猜你喜欢
    • 1970-01-01
    • 2020-05-06
    • 1970-01-01
    • 1970-01-01
    • 2015-11-14
    • 1970-01-01
    • 1970-01-01
    • 2021-01-30
    • 2017-04-16
    相关资源
    最近更新 更多