0

cassandra-cli -h localhost用来创建键空间。

我试过这个命令:create keyspace reddit with strategy_options = [{replication_factor:1}];和这个:create keyspace reddit with strategy_options = {replication_factor:1};,但我得到的是这个:

org.apache.thrift.transport.TTransportException

我在 ArchLinux(由 AUR 构建)上尝试了 Cassandra 1.1.6 和 1.2.2。(我正在运行 Cassandra systemctl start cassandra)。

另外,当我尝试use reddit; 创建键空间之前它返回时Keyspace 'reddit' not found.,但尝试创建键空间之后它返回Login failure. Did you specify 'keyspace', 'username' and 'password'?

编辑:忘了提,但create keyspace test;效果很好,但是当我使用 replication_factor 创建键空间时,它会引发异常。

4

1 回答 1

0

通过使用此查询解决:

create keyspace reddit with placement_strategy = 'org.apache.cassandra.locator.SimpleStrategy' and strategy_options = [{replication_factor:1}];

我通过阅读 /var/log/cassandra/system.log 来到这里:

CustomTThreadPoolServer.java (line 217) Error occurred during processing of message.
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
        at org.apache.cassandra.locator.AbstractReplicationStrategy.createReplicationStrategy(AbstractReplicationStrategy.java:230)
        at org.apache.cassandra.thrift.CassandraServer.system_add_keyspace(CassandraServer.java:1342)
        at org.apache.cassandra.thrift.Cassandra$Processor$system_add_keyspace.getResult(Cassandra.java:3960)
        at org.apache.cassandra.thrift.Cassandra$Processor$system_add_keyspace.getResult(Cassandra.java:3948)
        at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:32)
        at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:34)
        at org.apache.cassandra.thrift.CustomTThreadPoolServer$WorkerProcess.run(CustomTThreadPoolServer.java:199)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
        at org.apache.cassandra.locator.AbstractReplicationStrategy.createReplicationStrategy(AbstractReplicationStrategy.java:226)
        ... 9 more
Caused by: org.apache.cassandra.exceptions.ConfigurationException: replication_factor is an option for SimpleStrategy, not NetworkTopologyStrategy
        at org.apache.cassandra.locator.NetworkTopologyStrategy.<init>(NetworkTopologyStrategy.java:66)
        ... 14 more
于 2013-03-10T16:48:01.787 回答