Cassandra Add Node
Adding a node (bootstrapping) expands cluster capacity by introducing a new node that receives a portion of the existing data.
Prerequisites
Section titled “Prerequisites”- New node with Cassandra installed (same version as cluster)
- Network connectivity to existing nodes (ports 7000, 9042, 7199)
- Sufficient disk space for data share
cassandra.yamlconfigured with correct cluster name and seeds
Pre-Bootstrap Checklist
Section titled “Pre-Bootstrap Checklist”Step 1: Verify Cluster Health
Section titled “Step 1: Verify Cluster Health”# On existing nodenodetool statusAll nodes should show UN (Up/Normal).
Step 2: Check for Running Operations
Section titled “Step 2: Check for Running Operations”nodetool compactionstatsnodetool netstatsAvoid bootstrapping during heavy compaction or repairs.
Step 3: Prepare New Node
Section titled “Step 3: Prepare New Node”On new node:
# Verify Cassandra is installedcassandra -v
# Verify configurationgrep -E "cluster_name|seeds|listen_address" /etc/cassandra/cassandra.yamlRequired cassandra.yaml settings:
cluster_name: 'MyCluster' # Must match existing clusterseeds: "existing-node1,existing-node2" # 2-3 existing nodeslisten_address: <new-node-ip>rpc_address: <new-node-ip> # Or 0.0.0.0auto_bootstrap: true # Default, ensures data streamingStep 4: Clear Data Directories (If Reusing Hardware)
Section titled “Step 4: Clear Data Directories (If Reusing Hardware)”sudo rm -rf /var/lib/cassandra/data/*sudo rm -rf /var/lib/cassandra/commitlog/*sudo rm -rf /var/lib/cassandra/saved_caches/*sudo rm -rf /var/lib/cassandra/hints/*Bootstrap Procedure
Section titled “Bootstrap Procedure”Step 1: Start Cassandra on New Node
Section titled “Step 1: Start Cassandra on New Node”sudo systemctl start cassandra
# Monitor startuptail -f /var/log/cassandra/system.logStep 2: Monitor Bootstrap Progress
Section titled “Step 2: Monitor Bootstrap Progress”On any node:
nodetool statusNew node will show as UJ (Up/Joining) during bootstrap.
# On new node - watch streamingnodetool netstatsStep 3: Wait for Completion
Section titled “Step 3: Wait for Completion”Bootstrap can take hours. The node is not fully operational until complete.
# Monitor from existing nodewatch -n 60 'nodetool status'Step 4: Verify Completion
Section titled “Step 4: Verify Completion”nodetool statusNew node should show UN (Up/Normal).
Step 5: Run Cleanup on Existing Nodes
Section titled “Step 5: Run Cleanup on Existing Nodes”After successful bootstrap, run cleanup to remove data that moved to new node:
# On each existing nodenodetool cleanup
# Or cleanup specific keyspacenodetool cleanup my_keyspaceCleanup Timing
Cleanup should be run after bootstrap completes but before the next repair. It removes data that no longer belongs to the node.
Troubleshooting
Section titled “Troubleshooting”Bootstrap Never Starts
Section titled “Bootstrap Never Starts”Check logs:
grep -i "bootstrap\|gossip\|schema" /var/log/cassandra/system.log | tail -50Common causes:
- Wrong cluster name → Fix in cassandra.yaml
- Cannot reach seeds → Check network connectivity
- Schema disagreement → Fix on existing cluster first
Bootstrap Fails Mid-Way
Section titled “Bootstrap Fails Mid-Way”# Check reasongrep -i "error\|failed" /var/log/cassandra/system.log | tail -50
# Common fixes:# 1. Clear data and retrysudo systemctl stop cassandrasudo rm -rf /var/lib/cassandra/data/*sudo systemctl start cassandra
# 2. If disk full on source nodesnodetool clearsnapshot --all # On source nodesBootstrap Very Slow
Section titled “Bootstrap Very Slow”# Check streaming throughputnodetool getstreamthroughput
# Increase if network allows (value in Mb/s by default)nodetool setstreamthroughput 400
# Or specify MiB/s explicitly with -m flagnodetool setstreamthroughput -m 50 # 50 MiB/sStreaming Throughput Units
nodetool setstreamthroughput uses megabits per second (Mb/s) by default. Use the -m flag to specify MiB/s instead. The cassandra.yaml setting stream_throughput_outbound uses MiB/s (24 MiB/s default in Cassandra 4.1+).
Node Joins but Shows Wrong Token Range
Section titled “Node Joins but Shows Wrong Token Range”This may indicate initial_token is set incorrectly or auto_bootstrap was false.
# Check token assignmentnodetool ring | grep <new-node-ip>
# May need to decommission and re-add with correct settingsStreaming Performance
Section titled “Streaming Performance”Speed Up Bootstrap
Section titled “Speed Up Bootstrap”On source and target nodes:
# Increase stream throughput (value in Mb/s by default)nodetool setstreamthroughput 400
# Or specify MiB/s explicitlynodetool setstreamthroughput -m 50 # 50 MiB/sMonitor Streaming
Section titled “Monitor Streaming”# On new nodenodetool netstats
# Watch for:# - Receiving from multiple nodes# - Progress increasingPost-Bootstrap Tasks
Section titled “Post-Bootstrap Tasks”1. Run Cleanup on Old Nodes
Section titled “1. Run Cleanup on Old Nodes”# On each existing node (one at a time to limit impact)nodetool cleanup2. Update Seed List (If Appropriate)
Section titled “2. Update Seed List (If Appropriate)”If adding to seed nodes, update cassandra.yaml on all nodes:
seeds: "node1,node2,new-node" # Add new node if it should be a seed3. Verify Data Distribution
Section titled “3. Verify Data Distribution”nodetool statusCheck that data is roughly balanced across nodes.
4. Run Repair (Recommended)
Section titled “4. Run Repair (Recommended)”# After cleanup, ensure data consistencynodetool repair -prAdding Multiple Nodes
Section titled “Adding Multiple Nodes”When adding multiple nodes:
- Add one at a time - Wait for each bootstrap to complete
- Run cleanup after all additions - More efficient
- Alternatively: Add all at once with calculated tokens (advanced)
Sequential Addition
Section titled “Sequential Addition”# Node A: Start and wait for UN status# Node B: Start and wait for UN status# Node C: Start and wait for UN status# Then: Run cleanup on all existing nodesTime Estimation
Section titled “Time Estimation”| Cluster Data Size | Bootstrap Duration |
|---|---|
| < 100 GB total | 30 min - 1 hour |
| 100 GB - 1 TB | 1-4 hours |
| 1 TB - 10 TB | 4-24 hours |
| > 10 TB | 24+ hours |
Duration depends on:
- Total data in cluster
- Number of existing nodes
- Network bandwidth
- Disk I/O speed
Best Practices
Section titled “Best Practices”| Practice | Reason |
|---|---|
| Add during low-traffic periods | Reduces impact |
| Add one node at a time | Prevents overload |
| Monitor throughout | Catch issues early |
| Run cleanup after | Reclaim space on old nodes |
| Verify token distribution | Ensure balanced cluster |
| Update monitoring | Include new node |
Related Procedures
Section titled “Related Procedures”| Scenario | Procedure |
|---|---|
| Removing node | Decommission Node |
| Replacing failed node | Replace Dead Node |
| Cluster not healthy | Fix issues first |
Related Commands
Section titled “Related Commands”| Command | Purpose |
|---|---|
nodetool status | Cluster overview |
nodetool netstats | Streaming progress |
nodetool cleanup | Remove relocated data |
nodetool ring | Token distribution |
nodetool setstreamthroughput | Adjust streaming speed |