添加新节点后如何重新平衡Cassandra群集 [英] how to rebalance cassandra cluster after adding new node
问题描述
我有一个3节点的cassandra群集,其复制因子为2。这些节点运行的是dsc1.2.3或dsc1.2.4。每个节点的num_token值为256,并注释了initial_token。这3个节点的集群是完美平衡的,即每个集群拥有大约30%的数据。
I had a 3 node cassandra cluster with replication factor of 2. The nodes were running either dsc1.2.3 or dsc1.2.4. Each node had num_token value of 256 and initial_token was commented. This 3 node cluster was perfectly balanced i.e. each owned around 30% of the data.
其中一个节点崩溃了,所以我启动了一个新节点,nodetool删除了崩溃的节点。新节点已添加到集群中,但是两个较旧的节点现在拥有大部分数据(47.0%和52.3%),而新节点仅拥有0.7%的数据。
One of the nodes crashed so I started a new node and nodetool removed the node that had crashed. The new node got added to the cluster but the two older nodes have most of the data now (47.0% and 52.3%) and the new node has just 0.7% of the data.
nodetool状态的输出为
The output of nodetool status is
Datacenter: xx-xxxx
===================
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
-- Address Load Tokens Owns Host ID Rack
UN 10.xxx.xxx.xxx 649.78 MB 256 47.0% ba3534b3-3d9f-4db7-844d-39a8f98618f1 1c
UN 10.xxx.xxx.xxx 643.11 MB 256 52.3% 562f7c3f-986a-4ba6-bfda-22a10e384960 1a
UN 10.xxx.xxx.xxx 6.84 MB 256 0.7% 5ba6aff7-79d2-4d62-b5b0-c5c67f1e1791 1c
我如何平衡该群集?
推荐答案
您没有提到在新节点上进行修复,如果确实尚未进行修复,则可能是新节点上缺少数据的原因。
You didn't mention running a repair on the new node, if indeed you haven't yet done that it's likely the cause of your lack of data on the new node.
在运行nodetool修复之前,新节点将仅保存写入其中的新数据或读取修复后的数据。如果我正确理解vnode,lly不需要重新平衡,但是我个人还没有使用vnode,所以我对此可能是错的。
Until you run a nodetool repair the new node will only hold the new data that gets written to it or the data that read-repair pulls in. With vnodes you generally shouldn't need to re-balance, if I'm understanding vnodes correctly, but I haven't personally yet moved to using vnodes so I may be wrong about that.
这篇关于添加新节点后如何重新平衡Cassandra群集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!