cassandra how to delete a node

There may be many machines in a cassandra cluster, so many machines must have the chance of downtime, and the more machines, the greater the chance, when a downtime occurs, how do you delete a node?

This article only applies to cassandra clusters that use vnodes. How to judge whether vnodes are used? It mainly depends on whether initial_token is configured in your cassandra.yml configuration file. If not, vnodes are used. With vnodes, it will balance the data by itself after deleting the node, you don't need to deal with it manually.

According to the official documentation, the operation steps are as follows:

Step 1: Repair each keyspace on each machine first
nodetool repair -h ip_address_of_node keyspace_name
Step 2: If the machine you want to delete is an UP state machine,
you can execute nodetool decommission on the machine to be deleted . Just end directly, otherwise continue:
Step 3: If your machine is down.
You need to execute the nodetool status command on a live machine first to get the id of the down node
$ nodetool status

Datacenter: DC1
===============
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
—  Address        Load       Tokens  Owns (effective)  Host ID                               Rack
UN  192.168.2.101  112.82 KB  256     31.7%             420129fc-0d84-42b0-be41-ef7dd3a8ad06  RAC1
DN  192.168.2.103  91.11 KB   256     33.9%             d0844a21-3698-4883-ab66-9e2fd5150edd  RAC1
UN  192.168.2.102  124.42 KB  256     32.6%             8d5ed9f4-7764-4dbd-bad8-43fddce94b7c  RAC1

Step 4: Execute the delete operation
nodetool removenode d0844a21-3698-4883-ab66-9e2fd5150edd on the live node.
It will balance the data by itself, so it ends here, otherwise continue.
Step 5: Use nodetool status again to see if the node is deleted successfully
$ nodetool status

Datacenter: DC1
===============
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
—  Address        Load       Tokens  Owns (effective)  Host ID                               Rack
UN  192.168.2.101  112.82 KB  256     37.7%             420129fc-0d84-42b0-be41-ef7dd3a8ad06  RAC1
UN  192.168.2.102  124.42 KB  256     38.3%             8d5ed9f4-7764-4dbd-bad8-43fddce94b7c  RAC1

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326847346&siteId=291194637