2013-03-10 82 views
0

我正在使用cassandra-cli -h localhost來創建密鑰空間。創建密鑰空間時出現TTransportException

我試過這個命令:create keyspace reddit with strategy_options = [{replication_factor:1}];和這一個:create keyspace reddit with strategy_options = {replication_factor:1};,但我得到的是這樣的:

org.apache.thrift.transport.TTransportException 

我對Cassandra的1.1.6和1.2.2試穿的ArchLinux(AUR從建)。 (我正在用systemctl start cassandra運行Cassandra)。

而且,當我嘗試use reddit;前後創建密鑰空間返回Keyspace 'reddit' not found.,但試圖創建密鑰空間返回Login failure. Did you specify 'keyspace', 'username' and 'password'?

編輯:忘了提及,但create keyspace test;工程很好,但是當我用replication_factor創建keyspace時,它會拋出異常。

回答

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 
相關問題