How to create a keyspace in cassandra

I am trying to create a keypace in cassandra1.1.9 and I did the same as "help create keyspace" prompts me.

CREATE KEYSPACE testkeyspace with placement_strategy = 'org.apache.cassandra.locator.SimpleStrategy' and strategy_options = [{replication_factor: 2}];
 EVEN SAID THIS
create a testkeyspace;
update keyspace testkeyspace with strategy_location = 'org.apache.cassandra.locator.SimpleStrategy' and strategy_options = {replication_factor: 3};


I always got this error:
java.lang.IllegalArgumentException: no enum const class org.apache.cassandra.cli.CliClient $ AddKeyspaceArgument.STRATEGY_OPT: ONS
+3


source to share


5 answers


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



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

      

+5


source


I am on version 1.2.8, but the only syntax that worked for me is this:



create keyspace demo with replication = {'class':'SimpleStrategy', 'replication_factor':1}

      

+7


source


This work for me:

"CREATE KEYSPACE # {keyspace} WITH strategy_class = 'SimpleStrategy' AND strategy_options: replication_factor = 3"

0


source


cqlsh:CREATE KEYSPACE keyspace_name 
      WITH strategy_class='SimpleStrategy' AND strategy_options:replication_factor='1';  

      

0


source


If you have multiple datacenters in a cassandra cluster and want to keep one copy in each datacenter, then you can use the following command:

Following is the command for the CLI interface:

create keyspace KEY_SPACE  with placement_strategy = 'org.apache.cassandra.locator.NetworkTopologyStrategy' and strategy_options={DC1:1, DC2:1, DC3:1};

      

0


source







All Articles