cassandra – 无法达到一致性级别ONE:info = {‘required_replicas’:1,’alive_replicas’:0,’consistency’:1}

在我的Cassandra设置中看起来键空间复制没有正确发生,我需要一些想法来解决这个问题.我已经配置了多数据中心集群,但首先我设置了密钥空间以使用SimpleStrategy和RF 3.

列族存在:

cqlsh:kairosdb> select columnfamily_name from system.schema_columnfamilies where keyspace_name = 'kairosdb';

 columnfamily_name
-------------------
       data_points
     row_key_index
      string_index

(3 rows)

但我无法查询它们:

cqlsh:kairosdb> select count(*) from data_points limit 100000;
 Traceback (most recent call last):
  File "/usr/bin/cqlsh", line 957, in perform_simple_statement
    rows = self.session.execute(statement, trace=self.tracing_enabled)
  File "/usr/share/cassandra/lib/cassandra-driver-internal-only-2.1.1.post.zip/cassandra-driver-2.1.1.post/cassandra/cluster.py", line 1282, in execute
    result = future.result(timeout)
  File "/usr/share/cassandra/lib/cassandra-driver-internal-only-2.1.1.post.zip/cassandra-driver-2.1.1.post/cassandra/cluster.py", line 2776, in result
    raise self._final_exception
Unavailable: code=1000 [Unavailable exception] message="Cannot achieve consistency level ONE" info={'required_replicas': 1, 'alive_replicas': 0, 'consistency': 1}

这就是我设置多数据中心设置的方法:

>在种子列表中使用每个DC的2个节点
>使用org.apache.cassandra.locator.GossipingPropertyFileSnitch for the Snitch
>在cassandra-rackdc.properties中为节点指定不同的DC名称

这是创建键空间:

cqlsh:kairosdb> describe keyspace kairosdb;

CREATE KEYSPACE kairosdb WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '3'}  AND durable_writes = true;

我有什么想法可以解决这个问题吗?

在您的密钥空间创建中,您有以下语法:

CREATE KEYSPACE kairosdb WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '3'}  AND durable_writes = true;

但是,如果您希望跨数据中心(DC)使用复制,则需要使用NetworkTopologyStrategy,例如:

CREATE KEYSPACE kairosdb WITH replication = {'class': 'NetworkTopologyStrategy', 'DC1': 3, 'DC2': 3};

根据以下文档链接,“当您(或计划拥有)跨多个数据中心部署的集群时,请使用NetworkTopologyStrategy ……”

http://www.datastax.com/documentation/cassandra/2.0/cassandra/architecture/architectureDataDistributeReplication_c.html

相关文章
相关标签/搜索