Cassandra Decommission Node
Decommissioning removes a node from the cluster by streaming its data to remaining nodes. This is the proper way to permanently remove a healthy node.
Prerequisites
Section titled “Prerequisites”- Node is UP and operational
- Cluster has sufficient capacity after removal
- No other operations (repair, bootstrap) running
- Recent backup available
When NOT to Use Decommission
- If node is DOWN: Use
nodetool removenodeinstead - If node is unresponsive: Use
nodetool assassinate(last resort) - If removing multiple nodes: Decommission one at a time
Pre-Decommission Checklist
Section titled “Pre-Decommission Checklist”Step 1: Verify Cluster Health
Section titled “Step 1: Verify Cluster Health”nodetool statusAll other nodes should show UN (Up/Normal).
Step 2: Check Capacity After Removal
Section titled “Step 2: Check Capacity After Removal”# Current data per nodenodetool status | awk '/^UN/ {print $1, $3}'
# Verify remaining nodes can absorb data# Rule: Each remaining node should have < 70% disk after decommissionStep 3: Run Repair First (Optional but Recommended)
Section titled “Step 3: Run Repair First (Optional but Recommended)”# Ensures data is consistent before streamingnodetool repair -prStep 4: Disable Auto-Bootstrap (Precaution)
Section titled “Step 4: Disable Auto-Bootstrap (Precaution)”Ensure auto_bootstrap: false won't be an issue if node accidentally restarts.
Step 5: Notify Stakeholders
Section titled “Step 5: Notify Stakeholders”Decommission can take hours and impacts cluster performance during streaming.
Decommission Procedure
Section titled “Decommission Procedure”Step 1: Start Decommission
Section titled “Step 1: Start Decommission”On the node to be removed:
nodetool decommissionThis command:
- Stops accepting new writes
- Streams data to other replicas
- Leaves the token ring
- Shuts down (in some versions)
Step 2: Monitor Progress
Section titled “Step 2: Monitor Progress”In another terminal:
# Watch streaming progressnodetool netstats
# Watch decommission statusnodetool status | grep -E "UL|UJ|UN"# UL = Leaving, UJ = Joining, UN = NormalStep 3: Wait for Completion
Section titled “Step 3: Wait for Completion”Decommission can take hours depending on data size. Do not interrupt.
# Monitor from another nodewatch -n 60 'nodetool status'Step 4: Verify Completion
Section titled “Step 4: Verify Completion”From another node:
nodetool statusThe decommissioned node should no longer appear.
Step 5: Clean Up (After Decommission)
Section titled “Step 5: Clean Up (After Decommission)”On the decommissioned node (if still running):
# Stop Cassandra if still runningsudo systemctl stop cassandra
# Optionally remove datasudo rm -rf /var/lib/cassandra/data/*sudo rm -rf /var/lib/cassandra/commitlog/*sudo rm -rf /var/lib/cassandra/saved_caches/*Troubleshooting
Section titled “Troubleshooting”Decommission Seems Stuck
Section titled “Decommission Seems Stuck”# Check netstats for streaming activitynodetool netstats
# Check logstail -100 /var/log/cassandra/system.log | grep -i "stream\|decommission"If truly stuck (no progress for hours):
- Check disk space on receiving nodes
- Check network connectivity
- Check for errors in logs
Decommission Failed Mid-Way
Section titled “Decommission Failed Mid-Way”# Check node statusnodetool status
# If node shows UL (Leaving) but decommission failed:# Option 1: Restart and retrysudo systemctl restart cassandranodetool decommission
# Option 2: Cancel and diagnosenodetool netstats # Check for issuesNode Reappears After Decommission
Section titled “Node Reappears After Decommission”The node's data directories may not have been cleared:
# On the decommissioned node, clear all datasudo systemctl stop cassandrasudo rm -rf /var/lib/cassandra/data/*sudo rm -rf /var/lib/cassandra/commitlog/*Not Enough Space on Remaining Nodes
Section titled “Not Enough Space on Remaining Nodes”# Cancel decommission if possible (Ctrl+C usually works)# Then:# 1. Add more nodes first, OR# 2. Clean up snapshots on remaining nodesnodetool clearsnapshot --all# 3. Add disk capacityStreaming Performance
Section titled “Streaming Performance”Monitor Streaming
Section titled “Monitor Streaming”# Detailed streaming infonodetool netstats
# Streaming throughputnodetool getstreamthroughputSpeed Up Streaming (If Needed)
Section titled “Speed Up Streaming (If Needed)”# Increase throughput (value in Mb/s by default)nodetool setstreamthroughput 400
# Or specify MiB/s explicitly with -m flagnodetool setstreamthroughput -m 50 # 50 MiB/s
# On receiving nodes, adjust concurrent compactorsnodetool setconcurrentcompactors 2Streaming Throughput Units
nodetool setstreamthroughput uses megabits per second (Mb/s) by default. Use the -m flag to specify MiB/s instead.
Recovery If Interrupted
Section titled “Recovery If Interrupted”If decommission is interrupted:
Node Still in Cluster (UL Status)
Section titled “Node Still in Cluster (UL Status)”# Restart Cassandrasudo systemctl restart cassandra
# Retry decommissionnodetool decommissionNode Removed but Data Remains
Section titled “Node Removed but Data Remains”# Clear data and repurpose hardwaresudo systemctl stop cassandrasudo rm -rf /var/lib/cassandra/*
# Or re-add as new node (requires different IP or cleared system tables)Best Practices
Section titled “Best Practices”| Practice | Reason |
|---|---|
| Decommission one node at a time | Prevents overload |
| Run repair before decommission | Ensures data consistency |
| Monitor during process | Catch issues early |
| Have backup ready | Recovery option |
| Plan maintenance window | Performance impact |
| Verify capacity first | Prevent disk full |
Time Estimation
Section titled “Time Estimation”| Data per Node | Expected Duration |
|---|---|
| < 100 GB | 1-2 hours |
| 100-500 GB | 2-8 hours |
| 500 GB - 1 TB | 8-24 hours |
| > 1 TB | 24+ hours |
Duration depends on:
- Network bandwidth
- Disk I/O speed
- Stream throughput settings
- Concurrent operations
Related Procedures
Section titled “Related Procedures”| Scenario | Procedure |
|---|---|
| Node is DOWN | Replace Dead Node |
| Adding capacity | Add Node |
| Node unresponsive | Use nodetool removenode or assassinate |
Related Commands
Section titled “Related Commands”| Command | Purpose |
|---|---|
nodetool decommission | Remove healthy node |
nodetool removenode | Remove dead node |
nodetool netstats | Monitor streaming |
nodetool setstreamthroughput | Adjust streaming speed |
nodetool status | Verify cluster state |