如何在cassandra中添加一个退役节点?

时间:2016-07-10 20:46:57

标签: cassandra

我刚刚做了nodetool decommission并删除了节点,我正在尝试将其添加回来,所以我再次启动了cassandra(decomissioned node),但它似乎没有加入集群?

3 个答案:

答案 0 :(得分:9)

The other nodes will remember that the host ID you decommissioned should no longer be part of the cluster and will refuse to talk to it.

So if you want that machine to rejoin the cluster, you have to make it look like a new empty node so that the remaining nodes will let it rejoin. The easiest way to do that is to clear out all the data on the decommissioned node so that it will generate a new host ID for itself. Then it should be able to rejoin.

To clear out the old data, do this:

Stop Cassandra on the node, then:

rm -r <the commitlog_directory specified in cassandra.yaml>
rm -r <the data_file_directories specified in cassandra.yaml>
rm <the contents of the saved_caches_directory specified in cassandra.yaml>
rm <old logfiles in /var/log/cassandra/>

Then restart the Cassandra service

答案 1 :(得分:1)

首先停止退役节点上的cassandra并使用以下命令启动它:

$ sudo cassandra -Dcassandra.override_decommission = true

它将再次加入群集。

答案 2 :(得分:0)

您无法使用decommission命令重新加入节点。基本上发生的是你从集群中删除了节点并重新分配了令牌。您需要重新初始化该节点并让它加入群集。在执行退役时,您是否让节点完成数据流传输?