3

我正在尝试在 cassandra1.1.9 中创建密钥空间,并且我按照“帮助创建密钥空间”告诉我的方式进行了相同的操作。

使用 placement_strategy = 'org.apache.cassandra.locator.SimpleStrategy' 和 strategy_options = [{replication_factor:2}] 创建密钥空间测试密钥空间;
甚至尝试过创建密钥空间testkeyspace

使用 placement_strategy = 'org.apache.cassandra.locator.SimpleStrategy' 和 strategy_options = {replication_factor:3} 更新键空间 testkeyspace;


我总是收到这个错误:
java.lang.IllegalArgumentException: No enum const class org.apache.cassandra.cli.CliClient$AddKeyspaceArgument.STRATEGY_OPT:ONS

4

5 回答 5

7

我使用的是 1.2.8 版本,但唯一对我有用的语法是:

create keyspace demo with replication = {'class':'SimpleStrategy', 'replication_factor':1}
于 2013-08-27T00:15:22.313 回答
5

如果您使用的是 cassandra-cli,这是正确的语法:

CREATE KEYSPACE testkeyspace
with placement_strategy = 'org.apache.cassandra.locator.SimpleStrategy'
and strategy_options = {replication_factor:2};
于 2013-02-01T21:38:42.997 回答
0

如果您在 cassandra 集群中有多个数据中心,并且想在每个数据中心存储一份副本,那么您可以使用以下命令:

以下命令用于 CLI 界面:

create keyspace KEY_SPACE  with placement_strategy = 'org.apache.cassandra.locator.NetworkTopologyStrategy' and strategy_options={DC1:1, DC2:1, DC3:1};
于 2014-09-26T09:06:55.653 回答
0

这对我有用:

“创建键空间 #{keyspace} WITH strategy_class = 'SimpleStrategy' AND strategy_options:replication_factor = 3”

于 2013-02-22T06:27:50.077 回答
0
cqlsh:CREATE KEYSPACE keyspace_name 
      WITH strategy_class='SimpleStrategy' AND strategy_options:replication_factor='1';  
于 2013-10-04T10:46:50.063 回答