Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cqlsh getting started gives invalid syntax

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>
like image 251
shmish111 Avatar asked Oct 22 '25 22:10

shmish111


2 Answers

use below thing it will work.

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

like image 149
Helping Hand.. Avatar answered Oct 25 '25 01:10

Helping Hand..


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.

like image 21
shmish111 Avatar answered Oct 25 '25 01:10

shmish111