Jump to: navigation, search

How to Remove a Cassandra Cluster Node

Prepare your environment to run node tool on Feature Server host as described in the Running Nodetool on a Feature Server Host page.

First, listing current nodes:

 
java -cp libthrift-0.7.0.jar:cassandra-thrift-1.1.6.jar:commons-cli-1.1.jar:cassandra-all-1.1.6.jar org.apache.cassandra.tools.NodeCmd -h localhost -p 9192 ring
Address DC Rack Status State Load Owns Token
Xx xx xx xx xx xx 83794128212295607812427599225465974454
10.52.86.38 usw1 RAC1 Down Normal  ? 59.09% 14189180876230654535300830053153397235
10.51.29.29 usw1 RAC2 Up Normal 547.84 KB 3.45% 20055304209618966354482420882580629466
10.51.28.170 usw1 RAC1 Up Normal 498.49 KB 37.46% 83794128212295607812427599225465974454


When the node is up, you can run nodetool decommission in the node you want to remove. For example, node 10.51.29.29 is up so run the following command in this node to remove it.

 
java -cp libthrift-0.7.0.jar:cassandra-thrift-1.1.6.jar:commons-cli-1.1.jar:cassandra-all-1.1.6.jar org.apache.cassandra.tools.NodeCmd -h localhost -p 9192 decommission


If the node is down, it results in ‘dead’ Cassandra node situation if you add a node to the cluster and then delete the Virtual Machine.
To recover from this problem, you must remove the ‘dead’ node. There is no connection to Cassandra on the node being deleted, so you cannot use ‘decommission’ command. Use ‘removetoken’ instead.
For example, node 10.52.86.38 is Down. Run the following command by using its token in the any other node to remove 10.52.86.38.

 
java -cp libthrift-0.7.0.jar:cassandra-thrift-1.1.6.jar:commons-cli-1.1.jar:cassandra-all-1.1.6.jar org.apache.cassandra.tools.NodeCmd -h localhost -p 9192

Note that this command takes a while to complete.

Feedback

Comment on this article:

blog comments powered by Disqus
This page was last modified on June 1, 2017, at 22:49.