首页 > 解决方案 > Cassandra 数据中心不同步 - 如何诊断和重建?

问题描述

我有三个 cassandra 数据中心,其键空间如下所示:

CREATE KEYSPACE allotments WITH replication = {'class': 'NetworkTopologyStrategy', 'hk1': '3', 'hk2': '3', 'hk3': '3'}  AND durable_writes = false;

我最近安装了最新的集群 HK2 和 HK3,并将 auto_bootstrap 设置为 true(通过注释该行)。

然后,我继续使用原始数据中心 (HK1) 作为源在新数据中心(HK2 和 HK3)中的所有节点上运行重建命令:

nodetool rebuild -- hk1

但是,我发现自己遇到的问题是 HK2 似乎缺少数据,我无法找出原因或解决问题。

在 HK1 上(正确数据):

cqlsh> use allotments;
cqlsh:allotments> select count(*) from freesale_allotments;

 count
-------
 22035

(1 rows)

Warnings :
Aggregation query used without partition key

cqlsh:allotments> 

在 HK2 上(缺少数据):

cqlsh:allotments> use allotments;  
cqlsh:allotments> select count(*) from freesale_allotments;

 count
-------
 19142

(1 rows)

Warnings :
Aggregation query used without partition key

到目前为止尝试的故障排除步骤:

我尝试再次重建节点,重置本地数据。它只会在 2-3 秒内返回:

nodetool rebuild -m reset -- hk1

我尝试在所有节点上对密钥空间进行修复,大约 1 小时后成功完成,但计数保持不变。

nodetool repair allotments -pr

我已经尝试运行清理命令来清理所有损坏数据的表,并且再次 - 没有变化。

nodetool scrub

有人可以帮我指出正确的方向,以找出它是如何发生的,以及我将如何解决它。

非常感谢

马丁

标签: cassandra

解决方案


推荐阅读