Vsegar
Vsegar

Reputation: 113

cqlsh no viable alternative at input ':'

hello I need to execute this commande properly, remotly from jenkins

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};"'

But i have this error:

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

This is what i expect on cassandra table:

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

Upvotes: 1

Views: 1392

Answers (1)

Chris Lohfink
Chris Lohfink

Reputation: 16400

The error doesn't match what you pasted as your command. It looks from error like you have class instead of 'class'.

[with update] The ssh uses single quote for your shell command which looks like causes are some escaping issues ending the query after the WITH REPLICATION = {. If you use double quotes instead you can escape the ones in cqlsh arg with a backslash.

Upvotes: 2

Related Questions