我们是否可以在现有群集中添加新的数据中心具有更高的复制因子

时间:2017-10-11 10:52:44

标签: cassandra

在Cassandra中,要在同一群集中添加具有更高复制因子的新数据中心,会抛出错误,表示在任何源数据中心中找不到复制因子1的某个范围。

我的数据中心有(X-RF = 2)和(Y-RF = 1)。我想添加数据中心(Z - RF = 3)。

我在Datacenter Z中添加了一个节点。 但是在

  

nodetool rebuild - X

失败并显示错误

  

java.lang.IllegalStateException:无法在复制因子为1的密钥空间中找到足够的流范围源(-3685074324747697686,-3680615207285604279)

所有列系列的基本详情:

AND bloom_filter_fp_chance = 0.01

AND caching = '{"keys":"ALL", "rows_per_partition":"NONE"}'

AND comment = ''

AND compaction = {'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy'}

AND compression = {'sstable_compression': 'org.apache.cassandra.io.compress.LZ4Compressor'}

AND dclocal_read_repair_chance = 0.1

AND default_time_to_live = 0

AND gc_grace_seconds = 864000

AND max_index_interval = 2048

AND memtable_flush_period_in_ms = 0

AND min_index_interval = 128

AND read_repair_chance = 0.0

AND speculative_retry = '99.0PERCENTILE';

3 个答案:

答案 0 :(得分:0)

您需要做的是ALTER KEYSPACE然后再进行nodetool重建。复制从DESCRIBE KEYSPACE keyspace_name获得但在开头没有CREATE的文本。在复制中添加新数据中心。

ALTER KEYSPACE keyspace_name WITH REPLICATION = { 'class' : 'NetworkTopologyStrategy', 'datacenter1' : 1, 'datacenter2' : 3 };

然后做:

nodetool rebuild -- datacenter1

答案 1 :(得分:0)

Your current configuration, as shown in your keyspace definition, is for a single DC. You need to ALTER KEYSPACE it - to include another DC into it. This would start the replication process: keys that will be read/written would be replicated to the new DC. To fully copy all the data, you would need (in addition) to use the nodetool rebuild -- DC2 command

答案 2 :(得分:0)

根据您的评论 - “我改变了我的键空间,但对于像(system_distributed)这样的默认键空间,它会抛出错误”

除了用户特定的键空间外,请确保“system_distributed”等默认系统键空间位于“NetworkTopologyStrategy”上(SimpleStratergy上没有用于多DC的键空间,本地策略除外) 参考:Point-2 https://docs.datastax.com/en/cassandra/3.0/cassandra/operations/opsAddDCToCluster.html