Remove a node
To reduce the size of a cluster, you can remove nodes. This process removes the node without replacing it with a new node. To replace a node, see Replace a running node or Replace a dead node.
-
Use
nodetool statusto determine if the node is up (UN) or down (DN).For example:
Datacenter: datacenter1 ================================ Status=Up/Down |/ State=Normal/Leaving/Joining/Moving -- Address Load Tokens Owns Host ID Rack UN 10.200.177.92 265.04 KiB 1 ? 980cab6a-2e5d-44c6-b897-0733dde580ac rack1 DN 10.200.177.94 426.21 KiB 1 ? 7ecbbc0c-627d-403e-b8cc-a2daa93d9ad3 rack1 -
If the node is up, run
nodetool decommission.This command reassigns the node’s token ranges and replicates the node’s data appropriately before the node is removed from the cluster. To avoid excessive data streaming, decommission only one node at a time. You can use
nodetool netstatsto monitor the progress of decommissioning.If
nodetool decommissionsucceeds, stop HCD and shut down the node to finalize the removal.If
nodetool decommissionfails, proceed to the next step. -
If the node is down or
nodetool decommissionfails, remove the node according to your cluster architecture:-
Virtual nodes (vnodes): Run
nodetool removenode. Vnodes are automatically redistributed across the remaining nodes. -
Single-token architecture: Manually redistribute tokens across the remaining nodes by editing
initial_tokenincassandra.yaml, and then runnodetool removenode.In single-token architecture clusters (not using vnodes), you must manually rebalance the cluster before removing a node. If you don’t redistribute the tokens, the next node in the ring will take all tokens from the removed node, resulting in imbalanced data distribution and potential hot spots.
-
-
If
nodetool removenodefails, runnodetool assassinate.