nodetool enablehandoff
Re-enables hinted handoff on the node.
Synopsis
Section titled “Synopsis”nodetool [connection_options] enablehandoffSee connection options for connection options.
Description
Section titled “Description”nodetool enablehandoff re-enables the hinted handoff mechanism after it was disabled with disablehandoff. Hinted handoff is a critical consistency feature that stores write hints for temporarily unavailable nodes, ensuring data is delivered when those nodes recover.
When a coordinator receives a write request and a replica is temporarily unavailable, the coordinator stores a "hint" locally. Once the unavailable replica comes back online, the coordinator replays the hint to bring the replica up to date.
Consistency Mechanism
Hinted handoff is one of Cassandra's key mechanisms for maintaining eventual consistency. It ensures that writes intended for temporarily down nodes are not lost and are delivered when the node recovers.
Behavior
Section titled “Behavior”When hinted handoff is enabled:
- Coordinator nodes store hints for unavailable replicas
- Hints are stored as files in the hints directory (e.g.,
/var/lib/cassandra/hints/) - When target nodes recover, hints are replayed automatically
- Old hints expire based on the hint window setting (default: 3 hours)
| Cassandra Version | Parameter Name | Example |
|---|---|---|
| Pre-4.1 | max_hint_window_in_ms | 10800000 (3 hours) |
| 4.1+ | max_hint_window | 3h |
Hint Storage
Section titled “Hint Storage”Hints are stored on the coordinator node that received the original write request, not on the unavailable node.
Examples
Section titled “Examples”Basic Usage
Section titled “Basic Usage”nodetool enablehandoffVerify Status
Section titled “Verify Status”nodetool enablehandoffnodetool statushandoff# Expected: Hinted handoff is runningWhen to Use
Section titled “When to Use”After Maintenance
Section titled “After Maintenance”Re-enable hinted handoff after maintenance operations:
# Maintenance complete, restore normal operationnodetool enablehandoff
# Verify enablednodetool statushandoffAfter Troubleshooting
Section titled “After Troubleshooting”When handoff was disabled to investigate hint-related issues:
# Issue resolvednodetool enablehandoffAfter Node Recovery
Section titled “After Node Recovery”When restoring full functionality to a node:
# Enable handoffnodetool enablehandoff
# Check for pending hintsnodetool tpstats | grep -i hintImpact of Hinted Handoff
Section titled “Impact of Hinted Handoff”When Enabled (Normal)
Section titled “When Enabled (Normal)”| Scenario | Behavior |
|---|---|
| Replica down during write | Hint stored on coordinator |
| Replica recovers | Hints replayed automatically |
| Write consistency | Maintained via hint delivery |
| Coordinator disk | Uses space for hint storage |
When Disabled
Section titled “When Disabled”| Scenario | Behavior |
|---|---|
| Replica down during write | No hint stored |
| Replica recovers | Missing writes not delivered |
| Write consistency | Requires repair to restore |
| Coordinator disk | No hint storage overhead |
Consistency Risk
With hinted handoff disabled, writes to temporarily unavailable replicas are lost. The only way to restore consistency is through repair operations.
Understanding Hinted Handoff
Section titled “Understanding Hinted Handoff”How It Works
Section titled “How It Works”Write Request Flow (with hint):
1. Client → Coordinator: WRITE (CL=QUORUM, RF=3)
2. Coordinator sends to replicas: - Replica A: ✓ Success - Replica B: ✓ Success - Replica C: ✗ Timeout (node down)
3. Quorum satisfied (2/3), client gets success
4. Coordinator stores hint for Replica C
5. Later, when Replica C recovers: - Coordinator detects recovery via gossip - Hint is replayed to Replica C - Replica C receives the writeHint Window
Section titled “Hint Window”Hints are only stored for nodes that are expected to recover within the hint window:
max_hint_window: 3h # 4.1+ (duration format)# max_hint_window_in_ms: 10800000 # Pre-4.1 (milliseconds)If a node is down longer than the hint window, hints are not stored, and repair is required.
Configuration
Section titled “Configuration”cassandra.yaml Settings
Section titled “cassandra.yaml Settings”# Enable/disable hinted handoff globallyhinted_handoff_enabled: true
# Maximum time to store hints for a dead nodemax_hint_window: 3h # 4.1+ (duration format)# max_hint_window_in_ms: 10800000 # Pre-4.1
# Throttle hint deliveryhinted_handoff_throttle: 1024KiB # 4.1+ (data size format)# hinted_handoff_throttle_in_kb: 1024 # Pre-4.1
# Maximum hint delivery threadsmax_hints_delivery_threads: 2Runtime vs Configuration
Section titled “Runtime vs Configuration”| Method | Persistence | Scope |
|---|---|---|
nodetool enablehandoff | Until restart | This node only |
cassandra.yaml setting | Permanent | All restarts |
Monitoring Hints
Section titled “Monitoring Hints”Check Hint Status
Section titled “Check Hint Status”# View hinted handoff statusnodetool statushandoff
# Check hint-related thread poolsnodetool tpstats | grep -i hintCheck Pending Hints
Section titled “Check Pending Hints”# List pending hints by target nodenodetool listpendinghintsExample output:
Host ID Hints12345678-1234-1234-1234-123456789abc 152387654321-4321-4321-4321-cba987654321 42View Hints Table Size
Section titled “View Hints Table Size”# Check hints table sizenodetool tablestats system.hintsWorkflow: Recovery After Handoff Disable
Section titled “Workflow: Recovery After Handoff Disable”#!/bin/bashecho "=== Hinted Handoff Recovery ==="
# 1. Check current statusecho "1. Current status:"nodetool statushandoff
# 2. Enable hinted handoffecho ""echo "2. Enabling hinted handoff..."nodetool enablehandoff
# 3. Verify enabledecho ""echo "3. Verifying enabled:"nodetool statushandoff
# 4. Check for pending hintsecho ""echo "4. Pending hints:"nodetool listpendinghints
# 5. Check hint thread poolecho ""echo "5. Hint thread pool status:"nodetool tpstats | grep -i hint
echo ""echo "=== Complete ==="echo "NOTE: If handoff was disabled during node outages, run repair to restore consistency."Cluster-Wide Operations
Section titled “Cluster-Wide Operations”Enable on All Nodes
Section titled “Enable on All Nodes”#!/bin/bash# Get list of node IPs from local nodetoolnodes=$(nodetool status | grep "^UN" | awk '{print $2}')
echo "Enabling hinted handoff cluster-wide..."for node in $nodes; do echo -n "$node: " ssh "$node" "nodetool enablehandoff" 2>/dev/null && echo "enabled" || echo "FAILED"done
echo ""echo "Verification:"for node in $nodes; do echo -n "$node: " ssh "$node" "nodetool statushandoff" 2>/dev/nulldoneTroubleshooting
Section titled “Troubleshooting”Handoff Won't Enable
Section titled “Handoff Won't Enable”# Check JMX connectivitynodetool info
# Check logstail -100 /var/log/cassandra/system.log | grep -i hintHints Not Being Delivered
Section titled “Hints Not Being Delivered”If hints are not being replayed to recovered nodes:
# Check if target node is seen as UPnodetool status
# Check hint delivery threadsnodetool tpstats | grep -i hint
# Check for hint delivery errors in logsgrep -i "hint" /var/log/cassandra/system.log | tail -20High Hint Accumulation
Section titled “High Hint Accumulation”If hints are accumulating but not being delivered:
# Check pending hintsnodetool listpendinghints
# Check target nodes are UPnodetool status
# May need to truncate old hints and repair insteadnodetool truncatehintsnodetool repair -prBest Practices
Section titled “Best Practices”Hinted Handoff Guidelines
- Keep enabled in production - Hinted handoff is essential for consistency
- Monitor hint accumulation - Watch for growing hint backlogs
- Verify after enable - Confirm with
statushandoff - Consider hint window - Adjust based on expected outage durations
- Plan for repair - If disabled during outages, run repair afterward
- Monitor disk space - Hints consume disk on coordinators
Repair Required
If hinted handoff was disabled while nodes were down, run nodetool repair to restore consistency. Hints that would have been stored during that period are lost.
Related Commands
Section titled “Related Commands”| Command | Relationship |
|---|---|
| disablehandoff | Disable hinted handoff |
| statushandoff | Check handoff status |
| pausehandoff | Pause hint delivery |
| resumehandoff | Resume hint delivery |
| listpendinghints | List pending hints |
| truncatehints | Remove all hints |
| repair | Anti-entropy repair |