Skip to content

AxonOps — AI-Native Control Plane for Open Source Data Platforms

nodetool repair

Runs anti-entropy repair to synchronize data across replicas, ensuring consistency and preventing data resurrection from expired tombstones.


Terminal window
nodetool [connection_options] repair [options] [--] [keyspace [table ...]]

See connection options for connection options.

nodetool repair compares data between replica nodes using Merkle trees and streams any differences to ensure all replicas hold identical data. Repair is essential for:

  • Maintaining data consistency
  • Preventing tombstone resurrection (zombie data)
  • Recovering from node failures or network partitions

Comprehensive Repair Documentation

For detailed repair concepts, strategies, and scheduling guidance, see:


ArgumentDescription
keyspaceKeyspace to repair. Required for targeted repairs
tableSpecific table(s) to repair. If omitted, repairs all tables

OptionDescription
-pr, --partitioner-rangeRepair only primary range (recommended)
--fullFull repair instead of incremental
-seq, --sequentialRepair one node at a time
-dcpar, --dc-parallelParallel within DC, sequential across DCs
-dc, --in-dcRepair only within specified datacenter(s)
-local, --in-local-dcRepair only within local datacenter
-st, --start-tokenStart token for repair range
-et, --end-tokenEnd token for repair range
-j, --job-threadsNumber of repair job threads

Terminal window
nodetool repair -pr my_keyspace

Always Use -pr

Without -pr, each node repairs all ranges it holds (primary + replica), causing redundant work. With -pr, run repair on every node to cover all ranges exactly once.

Terminal window
# Full repair (default before 4.0)
nodetool repair --full -pr my_keyspace
# Incremental repair (default in 4.0+)
nodetool repair -pr my_keyspace
TypeBehaviorUse Case
FullRepairs all dataRecovery, initial sync
IncrementalRepairs only unrepaired dataRegular maintenance
Terminal window
nodetool repair -pr -local my_keyspace

Repairs only with replicas in the same datacenter.

Terminal window
nodetool repair -pr -st 0 -et 1000000000 my_keyspace

Repairs only the specified token range (subrange repair).


gc_grace_seconds Constraint

Repair must complete on all nodes within gc_grace_seconds (default 10 days) to prevent tombstone resurrection.

Terminal window
# Run on each node
nodetool repair -pr my_keyspace

After a node was down for extended time:

Terminal window
nodetool repair -pr my_keyspace

If nodes were isolated:

Terminal window
nodetool repair -pr my_keyspace

Ensure consistency before upgrading:

Terminal window
nodetool repair --full my_keyspace

Repair Considerations

Avoid repair:

  • During high traffic - Significant resource impact
  • While streaming - Interferes with bootstrap/decommission
  • With down nodes - Repair will fail or skip ranges
  • Immediately after bulk load - Wait for compaction

ResourceImpact
NetworkHigh - streams data between nodes
Disk I/OHigh - reads SSTables, writes repairs
CPUModerate - Merkle tree calculation
MemoryMerkle trees require heap space

During repair, the following operations impact cluster performance:

OperationDescription
Merkle Tree BuildComputes hash trees for data comparison
Data ComparisonCompares trees between replicas
Data StreamingStreams differing data between nodes

Expected impact during repair:

MetricImpact
Read latency+10-30%
Write latency+5-15%
Network utilization+20-50%

Terminal window
nodetool repair_admin list

Shows running repair sessions.

Terminal window
nodetool netstats

Shows streaming activity from repair.

Terminal window
nodetool repair_admin list --all

Shows completed and failed repairs.

Terminal window
nodetool repair_admin cancel <repair_id>

Canceling Repair

Canceled repairs leave data partially synchronized. Restart repair to complete synchronization.


Terminal window
# Run on each node sequentially
nodetool repair -pr my_keyspace
Terminal window
nodetool repair -pr my_keyspace users
Terminal window
nodetool repair -pr --parallel my_keyspace
Terminal window
# Repair with all DCs
nodetool repair -pr my_keyspace
# Repair specific DCs only
nodetool repair -pr -dc dc1 -dc dc2 my_keyspace
Terminal window
nodetool repair -pr --trace my_keyspace

ERROR: Repair failed with error: Repair job timed out

Solutions:

  • Reduce repair scope (single table)
  • Use subrange repair
  • Increase streaming_socket_timeout_in_ms
ERROR: Repair session already in progress

Check and wait for existing repair:

Terminal window
nodetool repair_admin list
ERROR: java.lang.OutOfMemoryError: Java heap space

Merkle trees consume heap. Solutions:

  • Reduce repair parallelism
  • Increase heap size
  • Use subrange repair

If data still appears inconsistent:

  1. Verify repair completed successfully
  2. Check all nodes were repaired
  3. Run nodetool repair --full for complete sync

Repair Guidelines

  1. Use -pr flag - Prevents redundant work
  2. Complete within gc_grace_seconds - Prevent zombies
  3. One node at a time - For sequential strategy
  4. Off-peak hours - Minimize production impact
  5. Monitor progress - Watch for failures
  6. Automate - Use AxonOps for scheduling
Cluster SizeStrategyFrequency
3-6 nodesSequentialWeekly
6-20 nodesParallelEvery 3-5 days
20-50 nodesDC-parallelEvery 2-3 days
50+ nodesContinuous (AxonOps)Always running

CommandRelationship
repair_adminManage repair sessions
netstatsMonitor streaming
statusCheck node states before repair
scrubFix local SSTable corruption