无法启动Cassandra:"节点已经存在"

时间:2015-03-28 23:11:30

标签: cassandra

我在重新启动后(在新的虚拟机实例上)让现有的Cassandra节点再次加入群集时遇到问题。

我有一个正在运行的Cassandra集群,其中4个节点都处于状态" up和normal"根据nodetool状态。节点在Azure中的虚拟机上运行。我更改了10.0.0.6的虚拟机的实例类型,该类型在重新启动此计算机时返回。机器停留在10.0.0.6。 重新启动后,我无法再次启动Cassandra。我得到了这个例外:

INFO  22:39:07 Handshaking version with /10.0.0.4
INFO  22:39:07 Node /10.0.0.6 is now part of the cluster
INFO  22:39:07 Node /10.0.0.5 is now part of the cluster
INFO  22:39:07 Handshaking version with cassandraprd001/10.0.0.6
INFO  22:39:07 Node /10.0.0.9 is now part of the cluster
INFO  22:39:07 Handshaking version with /10.0.0.5
INFO  22:39:07 Node /10.0.0.4 is now part of the cluster
INFO  22:39:07 InetAddress /10.0.0.6 is now UP
INFO  22:39:07 Handshaking version with /10.0.0.9
INFO  22:39:07 InetAddress /10.0.0.4 is now UP
INFO  22:39:07 InetAddress /10.0.0.9 is now UP
INFO  22:39:07 InetAddress /10.0.0.5 is now UP
ERROR 22:39:08 Exception encountered during startup
java.lang.RuntimeException: A node with address cassandraprd001/10.0.0.6 already exists, cancelling join. Use cassandra.replace_address if you want to replace this node.
    at org.apache.cassandra.service.StorageService.checkForEndpointCollision(StorageService.java:455) ~[apache-cassandra-2.1.0.jar:2.1.0]
    at org.apache.cassandra.service.StorageService.prepareToJoin(StorageService.java:667) ~[apache-cassandra-2.1.0.jar:2.1.0]
    at org.apache.cassandra.service.StorageService.initServer(StorageService.java:615) ~[apache-cassandra-2.1.0.jar:2.1.0]
    at org.apache.cassandra.service.StorageService.initServer(StorageService.java:509) ~[apache-cassandra-2.1.0.jar:2.1.0]
    at org.apache.cassandra.service.CassandraDaemon.setup(CassandraDaemon.java:338) [apache-cassandra-2.1.0.jar:2.1.0]
    at org.apache.cassandra.service.CassandraDaemon.activate(CassandraDaemon.java:457) [apache-cassandra-2.1.0.jar:2.1.0]
    at org.apache.cassandra.service.CassandraDaemon.main(CassandraDaemon.java:546) [apache-cassandra-2.1.0.jar:2.1.0]
java.lang.RuntimeException: A node with address cassandraprd001/10.0.0.6 already exists, cancelling join. Use cassandra.replace_address if you want to replace this node.
    at org.apache.cassandra.service.StorageService.checkForEndpointCollision(StorageService.java:455)
    at org.apache.cassandra.service.StorageService.prepareToJoin(StorageService.java:667)
    at org.apache.cassandra.service.StorageService.initServer(StorageService.java:615)
    at org.apache.cassandra.service.StorageService.initServer(StorageService.java:509)
    at org.apache.cassandra.service.CassandraDaemon.setup(CassandraDaemon.java:338)
    at org.apache.cassandra.service.CassandraDaemon.activate(CassandraDaemon.java:457)
    at org.apache.cassandra.service.CassandraDaemon.main(CassandraDaemon.java:546)
Exception encountered during startup: A node with address cassandraprd001/10.0.0.6 already exists, cancelling join. Use cassandra.replace_address if you want to replace this node.
INFO  22:39:08 Announcing shutdown

我正在使用Cassandra 2.1.0。我没有重播死节点 - 我只是想让旧节点重新启动并运行。根据nodetool状态(在其他节点上),所有节点都是" up和normal"除了10.0.0.6,这是" down和normal"。

如何让这个节点重新启动并运行?

3 个答案:

答案 0 :(得分:11)

首先,在另一个节点上,使用

nodetool status

结果显示群集中的节点列表。找到你的ip无法启动的节点,得到它的id并填写命令:

nodetool removenode <node_id>
然后开始cassandra。

最佳,

答案 1 :(得分:6)

快速回答,如果节点的IP是10.200.10.200

添加此

JVM_OPTS="$JVM_OPTS -Dcassandra.replace_address=10.200.10.200"

到你的

结尾
cassandra-env.sh

完成后不要忘记删除它。

答案 2 :(得分:3)

您可以查看此博客http://blog.alteroot.org/articles/2014-03-12/replace-a-dead-node-in-cassandra.html

它适用于我,这是Cassandra的一个错误。如果您的节点的host_id已更改,但使用的是旧IP,则会抛出此异常。

如果你使用Cassandra 2.x.x,你应该修改cassandra / conf / cassandra-env.sh。

最后,在完成引导后,不要忘记在cassandra-env.sh上删除修改!