Jim McGaw
Jim McGaw

Reputation: 768

Cassandra IllegalArgumentException creating keyspace

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?

Upvotes: 5

Views: 3534

Answers (2)

Schildmeijer
Schildmeijer

Reputation: 20946

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)

Upvotes: 18

manuzhang
manuzhang

Reputation: 3025

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

Upvotes: 1

Related Questions