Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cassandra IllegalArgumentException creating keyspace

Tags:

java

cassandra

I am using Cassandra 1.2, on Mac OS X Lion.

I have dropped into ./bin/cassandra-cli and am attempting to create a keyspace using the following syntax:

CREATE KEYSPACE my_keyspace WITH REPLICATION = { 'class': 'SimpleStrategy', 'replication_factor': 1 };

This command is copied almost entirely from the documentation for Cassandra 1.2 here, but I am getting a Java error:

java.lang.IllegalArgumentException: No enum const class org.apache.cassandra.cli.CliClient$AddKeyspaceArgument.REPLICATION

Does anyone know the root cause of this error and how I could go about fixing it?

like image 625
Jim McGaw Avatar asked Jan 19 '13 00:01

Jim McGaw


2 Answers

If you are using cassandra-cli this is the correct syntax:

CREATE KEYSPACE my_keyspace
with placement_strategy = 'org.apache.cassandra.locator.SimpleStrategy'
and strategy_options = {replication_factor:1};

(syntax you tried with is for cqlsh)

like image 169
Schildmeijer Avatar answered Oct 07 '22 10:10

Schildmeijer


That's the create keyspace command for CQL3 with bin/cqlsh -3
Schildmeijer's answer is for CLI

like image 38
manuzhang Avatar answered Oct 07 '22 09:10

manuzhang