nodetool disablehandoff
Disables hinted handoff on the node.
Synopsis
Section titled “Synopsis”nodetool [connection_options] disablehandoffSee connection options for connection options.
Description
Section titled “Description”nodetool disablehandoff disables the hinted handoff mechanism on the node. When disabled, the node will not store hints for writes intended for temporarily unavailable replicas. This is a significant change that affects data consistency guarantees.
Non-Persistent Setting
This setting is applied at runtime only and does not persist across node restarts. After a restart, hinted handoff reverts to the hinted_handoff_enabled setting in cassandra.yaml (default: true).
To make the change permanent, update cassandra.yaml:
hinted_handoff_enabled: falseCritical Consistency Impact
Disabling hinted handoff means writes to unavailable replicas will be lost and only recoverable through repair operations. Use this command with extreme caution in production environments.
Behavior
Section titled “Behavior”When hinted handoff is disabled:
- No new hints are stored for unavailable replicas
- Existing hints continue to be delivered (unless paused)
- Writes to down nodes are acknowledged but data is lost for those replicas
- Repair becomes the only mechanism to restore consistency
What Continues
Section titled “What Continues”| Feature | Status |
|---|---|
| Existing hint delivery | Continues (unless paused) |
| Writes | Succeed if consistency level met |
| Gossip | Continues normally |
| Compaction | Continues normally |
What Stops
Section titled “What Stops”| Feature | Status |
|---|---|
| New hint storage | Disabled |
| Automatic recovery | Requires repair |
| Write durability to down nodes | Lost |
Examples
Section titled “Examples”Basic Usage
Section titled “Basic Usage”nodetool disablehandoffVerify Disabled
Section titled “Verify Disabled”nodetool disablehandoffnodetool statushandoff# Expected: Hinted handoff is not runningWhen to Use
Section titled “When to Use”Disk Space Emergency
Section titled “Disk Space Emergency”When coordinator nodes are running out of disk space due to hint accumulation:
# 1. Disable new hint storagenodetool disablehandoff
# 2. Truncate existing hintsnodetool truncatehints
# 3. Free more space if needednodetool clearsnapshot --all
# 4. Re-enable when space is availablenodetool enablehandoffTroubleshooting Hint Storms
Section titled “Troubleshooting Hint Storms”When hint replay is causing performance issues:
# 1. Pause hint delivery firstnodetool pausehandoff
# 2. If issues persist, disable completelynodetool disablehandoff
# 3. Investigate and resolve# ...
# 4. Re-enablenodetool enablehandoffDuring Controlled Decommission
Section titled “During Controlled Decommission”Sometimes disabled before decommissioning nodes:
# On all nodes, disable hints for the departing nodenodetool disablehintsfordc dc_being_removed
# Or disable globally during the operationnodetool disablehandoffLong-Term Node Outage
Section titled “Long-Term Node Outage”When a node will be down longer than the hint window:
# Hints won't be stored anyway after window expires# May choose to disable to reduce coordinator overheadnodetool disablehandoff
# Plan for repair when node returnsImpact Assessment
Section titled “Impact Assessment”Immediate Effects
Section titled “Immediate Effects”| Aspect | Impact |
|---|---|
| New hint storage | Stops immediately |
| Coordinator disk usage | Stops growing from hints |
| Write acknowledgments | Continue normally |
| Consistency level satisfaction | Unchanged |
Consistency Implications
Section titled “Consistency Implications”| Scenario | With Handoff | Without Handoff |
|---|---|---|
| Node down 5 minutes | Hints stored, auto-recovery | Data lost, needs repair |
| Node down 1 hour | Hints stored, auto-recovery | Data lost, needs repair |
| Node down 4 hours | Beyond window, needs repair | Data lost, needs repair |
Silent Data Loss
With handoff disabled, writes to unavailable replicas appear to succeed (if consistency level is met) but the data is silently lost for those replicas. There's no error or indication of the missing data until inconsistencies are discovered.
Workflow: Emergency Disk Space Recovery
Section titled “Workflow: Emergency Disk Space Recovery”#!/bin/bashecho "=== Emergency Hint Cleanup ==="echo "WARNING: This will prevent automatic recovery for down nodes!"echo ""
# 1. Check current hint statusecho "1. Current hint status:"nodetool statushandoffecho ""
echo "Pending hints:"nodetool listpendinghintsecho ""
echo "Hints table size:"nodetool tablestats system.hints | grep "Space used"echo ""
# 2. Disable new hintsecho "2. Disabling hinted handoff..."nodetool disablehandoff
# 3. Truncate existing hintsecho "3. Truncating existing hints..."nodetool truncatehints
# 4. Verify cleanupecho "4. Verification:"echo "Hints table after truncate:"nodetool tablestats system.hints | grep "Space used"echo ""
echo "=== Complete ==="echo ""echo "IMPORTANT: Run 'nodetool repair' to restore consistency!"echo "Remember to re-enable: nodetool enablehandoff"Risks and Mitigations
Section titled “Risks and Mitigations”Risk: Silent Data Inconsistency
Section titled “Risk: Silent Data Inconsistency”Cause: Writes to down nodes are lost without indication
Mitigation:
- Schedule immediate repair after re-enabling
- Monitor for node down events during disabled period
- Keep disabled period as short as possible
# After re-enablingnodetool enablehandoff
# Run repair to restore consistencynodetool repair -prRisk: Forgot to Re-enable
Section titled “Risk: Forgot to Re-enable”Symptom: Ongoing data inconsistency
Mitigation:
# Set a reminderecho "nodetool enablehandoff" | at now + 1 hour
# Include in monitoringnodetool statushandoff | grep -q "not running" && \ echo "WARNING: Hinted handoff is disabled!"Risk: Multiple Nodes with Different States
Section titled “Risk: Multiple Nodes with Different States”Cause: Inconsistent cluster configuration
Mitigation:
# Audit all nodesfor node in $(nodetool status | grep "^UN" | awk '{print $2}'); do echo -n "$node: " ssh "$node" "nodetool statushandoff"doneMonitoring While Disabled
Section titled “Monitoring While Disabled”Track Duration
Section titled “Track Duration”# Log when disabledecho "$(date): Hinted handoff disabled" >> /var/log/cassandra/handoff_changes.log
# Log when re-enabledecho "$(date): Hinted handoff enabled" >> /var/log/cassandra/handoff_changes.logMonitor Node Status
Section titled “Monitor Node Status”While handoff is disabled, closely monitor for node failures:
# Watch cluster statuswatch -n 30 'nodetool status | grep -v "^UN"'
# Any node not UN means potential data lossCheck for Impact
Section titled “Check for Impact”# After re-enabling, check for inconsistenciesnodetool describecluster
# Run repair on potentially affected keyspacesnodetool repair -pr my_keyspaceCluster-Wide Operations
Section titled “Cluster-Wide Operations”Disable on All Nodes
Section titled “Disable on All Nodes”#!/bin/bashecho "WARNING: Disabling hinted handoff cluster-wide!"echo "This will prevent automatic recovery for node outages."echo ""# Get list of node IPs from local nodetool status
nodes=$(nodetool status | grep "^UN" | awk '{print $2}')
for node in $nodes; do echo -n "$node: " ssh "$node" "nodetool disablehandoff 2>/dev/null && echo "disabled" || echo "FAILED""done
echo ""echo "Verification:"for node in $nodes; do echo -n "$node: " ssh "$node" "nodetool statushandoff 2>/dev/null"done
echo ""echo "REMEMBER: Re-enable with: nodetool enablehandoff"echo "REMEMBER: Run repair afterward: nodetool repair -pr"Troubleshooting
Section titled “Troubleshooting”Handoff Already Disabled
Section titled “Handoff Already Disabled”If you expected it to be enabled:
# Check cassandra.yaml settinggrep hinted_handoff_enabled /etc/cassandra/cassandra.yaml
# Check if runtime disablednodetool statushandoff
# Enable if needednodetool enablehandoffCannot Disable
Section titled “Cannot Disable”# Check JMX connectivitynodetool info
# Check logs for errorstail -100 /var/log/cassandra/system.log | grep -i hintRecovery Procedure
Section titled “Recovery Procedure”After re-enabling hinted handoff:
#!/bin/bashecho "=== Recovery After Hinted Handoff Disable ==="
# 1. Re-enable hinted handoffecho "1. Enabling hinted handoff..."nodetool enablehandoff
# 2. Verify enabledecho ""echo "2. Verification:"nodetool statushandoff
# 3. Check cluster statusecho ""echo "3. Cluster status (check for any DN nodes):"nodetool status | head -15
# 4. Run repair for affected keyspacesecho ""echo "4. Running repair..."# For each keyspace that may have been affected:for ks in $(nodetool tablestats | grep "Keyspace:" | awk '{print $2}' | grep -v "^system"); do echo "Repairing $ks..." nodetool repair -pr $ksdone
echo ""echo "=== Recovery Complete ==="Best Practices
Section titled “Best Practices”Disable Guidelines
- Avoid in production - Only disable as last resort
- Document the reason - Log why and when disabled
- Set time limits - Don't leave disabled indefinitely
- Monitor closely - Watch for node failures during disabled period
- Plan for repair - Schedule repair immediately after re-enabling
- Communicate - Inform team when handoff is disabled
Never Do
- Leave handoff disabled for extended periods
- Disable without a recovery plan
- Assume data is consistent after disabling
- Forget to repair after re-enabling
Related Commands
Section titled “Related Commands”| Command | Relationship |
|---|---|
| enablehandoff | Re-enable hinted handoff |
| statushandoff | Check handoff status |
| pausehandoff | Pause hint delivery |
| resumehandoff | Resume hint delivery |
| truncatehints | Remove all hints |
| listpendinghints | List pending hints |
| repair | Anti-entropy repair |