我是Cassandra的初学者。我试过这个
cqlsh> CREATE KEYSPACE cycling
... WITH REPLICATION = {'class' : 'SimpleStrategy', 'datacenter1' : 1 };
但是无法识别datacenter1
ConfigurationException: Unrecognized strategy option {datacenter1} passed to SimpleStrategy for keyspace cycling
为什么?
答案 0 :(得分:5)
The SimpleStrategy
doesn't support that option. The correct create statement would be:
CREATE KEYSPACE cycling WITH REPLICATION = {'class':'SimpleStrategy', 'replication_factor':1};
If you want to specify replication by datacenter then you need to use the NetworkTopologyStrategy
, in which case the create statement would be:
CREATE KEYSPACE cycling WITH REPLICATION = {'class':'NetworkTopologyStrategy','datacenter1':1};
More information on this can be found here