Question

I'm following http://wiki.apache.org/cassandra/GettingStarted

The first thing I do in cqlsh is

cqlsh> CREATE KEYSPACE mykeyspace WITH REPLICATION = {'class' : 'SimpleStrategy', 'replication_factor' : 1 };
Invalid syntax at line 1, char 47
  CREATE KEYSPACE mykeyspace WITH REPLICATION = {'class' : 'SimpleStrategy', 'replication_factor' : 1 };
                                                ^
cqlsh> 

What am I doing wrong?

cqlsh> SHOW VERSION;
[cqlsh 2.2.0 | Cassandra 1.1.12 | CQL spec 2.0.0 | Thrift protocol 19.33.0]
cqlsh>
Was it helpful?

Solution 2

The solution was that the Cassandra page for installing from deb wasn't very clear to me:

Alternatively, you can install directly from the ASF repositories:

deb http://www.apache.org/dist/cassandra/debian 11x main

deb-src http://www.apache.org/dist/cassandra/debian 11x main

You will want to replace 11x by the series you want to use: `10x for the 1.0.x series, 08x for the 0.8.x series, etc... You will not automatically get major version updates unless you change the series, but that is a feature.

As it had 11x in the documentation I assumed that was the latest version rather than 20x as it should have been, then everything worked.

OTHER TIPS

use below thing it will work.

CREATE SCHEMA mykeyspace WITH replication = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };

I'm only going to mention this here because I had the same problem.

There's always a chance that if you're copy/pasting from a text editor that's using some different encoding or has some hidden whitespace characters, the cqlsh client is breaking on those invalid characters. In those cases, it's always worth typing it out just be sure.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top