nodetool statushandoff
Displays the current status of hinted handoff on the node.
Synopsis
Section titled “Synopsis”nodetool [connection_options] statushandoffSee connection options for connection options.
Description
Section titled “Description”nodetool statushandoff reports whether the hinted handoff mechanism is currently enabled or disabled on the node. This command is essential for verifying the state of hinted handoff after enable/disable operations and for routine health checks.
Hinted handoff is a critical consistency mechanism that stores write hints for temporarily unavailable replicas, ensuring data is delivered when those replicas recover.
Output
Section titled “Output”Enabled (Normal State)
Section titled “Enabled (Normal State)”Hinted handoff is runningDisabled
Section titled “Disabled”Hinted handoff is not runningExamples
Section titled “Examples”Basic Usage
Section titled “Basic Usage”nodetool statushandoffCheck After Enable/Disable
Section titled “Check After Enable/Disable”# After disablingnodetool disablehandoffnodetool statushandoff# Expected: Hinted handoff is not running
# After enablingnodetool enablehandoffnodetool statushandoff# Expected: Hinted handoff is runningOutput Interpretation
Section titled “Output Interpretation”| Output | Meaning | Action Needed |
|---|---|---|
Hinted handoff is running | Handoff is enabled | None (normal state) |
Hinted handoff is not running | Handoff is disabled | Consider re-enabling |
Default State
Hinted handoff is enabled by default. A "not running" status indicates someone explicitly disabled it or it was disabled in cassandra.yaml.
Use Cases
Section titled “Use Cases”Verify After Operations
Section titled “Verify After Operations”Confirm enable/disable commands took effect:
# Verify after disablenodetool disablehandoffnodetool statushandoff# Confirm: Hinted handoff is not running
# Verify after enablenodetool enablehandoffnodetool statushandoff# Confirm: Hinted handoff is runningHealth Check Integration
Section titled “Health Check Integration”Include in operational health checks:
#!/bin/bashstatus=$(nodetool statushandoff 2>/dev/null)
if echo "$status" | grep -q "is running"; then echo "OK: Hinted handoff is enabled" exit 0else echo "WARNING: Hinted handoff is disabled!" exit 1fiPre-Maintenance Check
Section titled “Pre-Maintenance Check”Verify state before maintenance operations:
echo "=== Hinted Handoff Status Before Maintenance ==="nodetool statushandoff
# Perform maintenance...
echo "=== Hinted Handoff Status After Maintenance ==="nodetool statushandoffTroubleshooting Consistency Issues
Section titled “Troubleshooting Consistency Issues”When investigating data consistency problems:
# Check if handoff is enablednodetool statushandoff
# If disabled, consistency issues may be due to lost hints# Re-enable and run repairnodetool enablehandoffnodetool repair -prMonitoring Integration
Section titled “Monitoring Integration”Prometheus Exporter
Section titled “Prometheus Exporter”Export status as a metric:
#!/bin/bash# Export handoff status for monitoring
status=$(nodetool statushandoff 2>/dev/null)
if echo "$status" | grep -q "is running"; then echo "cassandra_hinted_handoff_enabled 1"else echo "cassandra_hinted_handoff_enabled 0"fiNagios/Icinga Check
Section titled “Nagios/Icinga Check”#!/bin/bashstatus=$(nodetool statushandoff 2>/dev/null)
if [ $? -ne 0 ]; then echo "UNKNOWN - Cannot connect to Cassandra" exit 3fi
if echo "$status" | grep -q "is running"; then echo "OK - Hinted handoff is enabled" exit 0else echo "CRITICAL - Hinted handoff is disabled" exit 2fiJSON Output for Monitoring
Section titled “JSON Output for Monitoring”#!/bin/bash# Output JSON for monitoring systems
status=$(nodetool statushandoff 2>/dev/null)enabled=$(echo "$status" | grep -q "is running" && echo "true" || echo "false")
cat <<EOF{ "timestamp": "$(date -Iseconds)", "metric": "hinted_handoff_status", "enabled": $enabled, "status_message": "$status"}EOFCluster-Wide Audit
Section titled “Cluster-Wide Audit”Check All Nodes
Section titled “Check All Nodes”#!/bin/bashecho "=== Cluster Hinted Handoff Audit ==="echo ""
# Get list of node IPs from local nodetool statusnodes=$(nodetool status | grep "^UN" | awk '{print $2}')
all_enabled=truefor node in $nodes; do status=$(ssh "$node" "nodetool statushandoff" 2>/dev/null) echo -n "$node: "
if echo "$status" | grep -q "is running"; then echo "ENABLED" else echo "DISABLED" all_enabled=false fidone
echo ""if [ "$all_enabled" = true ]; then echo "Status: All nodes have hinted handoff enabled"else echo "WARNING: Some nodes have hinted handoff disabled!"fiVerify Cluster Consistency
Section titled “Verify Cluster Consistency”#!/bin/bash# Get list of node IPs from local nodetool statusnodes=$(nodetool status | grep "^UN" | awk '{print $2}')enabled_count=0disabled_count=0
for node in $nodes; do status=$(ssh "$node" "nodetool statushandoff" 2>/dev/null) if echo "$status" | grep -q "is running"; then ((enabled_count++)) else ((disabled_count++)) fidone
total=$((enabled_count + disabled_count))
echo "Hinted Handoff Status Summary:"echo " Total nodes: $total"echo " Enabled: $enabled_count"echo " Disabled: $disabled_count"
if [ "$disabled_count" -gt 0 ] && [ "$enabled_count" -gt 0 ]; then echo "" echo "WARNING: Inconsistent state across cluster!" echo "Consider enabling on all nodes for consistency."fiUnderstanding Status Context
Section titled “Understanding Status Context”Status vs Pause State
Section titled “Status vs Pause State”The statushandoff command shows whether hint storage is enabled, not whether delivery is paused:
| Command | What It Checks |
|---|---|
statushandoff | Is hint storage enabled? |
| N/A (check tpstats) | Is hint delivery active? |
# Check both hint storage and delivery statusecho "Hint Storage Status:"nodetool statushandoff
echo ""echo "Hint Delivery Activity:"nodetool tpstats | grep -i hintRelated Status Commands
Section titled “Related Status Commands”# Complete hint system status checkecho "=== Hinted Handoff System Status ==="
echo "1. Handoff Status:"nodetool statushandoff
echo ""echo "2. Pending Hints:"nodetool listpendinghints
echo ""echo "3. Hint Thread Pool:"nodetool tpstats | grep -i hint
echo ""echo "4. Hints Table Size:"nodetool tablestats system.hints 2>/dev/null | grep "Space used" || echo "No hints table data"Configuration Check
Section titled “Configuration Check”Compare Runtime vs Config
Section titled “Compare Runtime vs Config”#!/bin/bash# Check if runtime matches configuration
echo "=== Hinted Handoff Configuration Check ==="
# Runtime statusecho "Runtime Status:"nodetool statushandoff
# Configuration fileecho ""echo "cassandra.yaml Setting:"grep "hinted_handoff_enabled" /etc/cassandra/cassandra.yaml 2>/dev/null || echo "Not found in config"
# Compareruntime_enabled=$(nodetool statushandoff 2>/dev/null | grep -q "is running" && echo "true" || echo "false")config_enabled=$(grep "hinted_handoff_enabled" /etc/cassandra/cassandra.yaml 2>/dev/null | grep -q "true" && echo "true" || echo "false")
echo ""if [ "$runtime_enabled" != "$config_enabled" ]; then echo "WARNING: Runtime status differs from configuration!" echo " Runtime: $runtime_enabled" echo " Config: $config_enabled" echo " This may indicate a runtime change that won't persist after restart."else echo "Runtime status matches configuration."fiTroubleshooting
Section titled “Troubleshooting”Command Returns Error
Section titled “Command Returns Error”# Check JMX connectivitynodetool info
# Verify Cassandra is runningpgrep -f CassandraDaemonUnexpected Status
Section titled “Unexpected Status”If status doesn't match expectations:
# Check cassandra.yaml settinggrep hinted_handoff_enabled /etc/cassandra/cassandra.yaml
# Check for recent enable/disable commands in logsgrep -i "hint" /var/log/cassandra/system.log | tail -20Status Differs Across Nodes
Section titled “Status Differs Across Nodes”If nodes show different statuses:
#!/bin/bash# Each node maintains its own handoff state# Synchronize by running on all nodes via SSH:
for node in $(nodetool status | grep "^UN" | awk '{print $2}'); do ssh "$node" "nodetool enablehandoff"done
# Verify consistencyfor node in $(nodetool status | grep "^UN" | awk '{print $2}'); do echo -n "$node: " ssh "$node" "nodetool statushandoff"doneAutomation Script
Section titled “Automation Script”#!/bin/bashOUTPUT_FILE="/var/log/cassandra/handoff_status_$(date +%Y%m%d).log"
echo "=== Hinted Handoff Status Report ===" | tee $OUTPUT_FILEecho "Generated: $(date)" | tee -a $OUTPUT_FILEecho "" | tee -a $OUTPUT_FILE
# Local node statusecho "Local Node Status:" | tee -a $OUTPUT_FILEnodetool statushandoff | tee -a $OUTPUT_FILE
echo "" | tee -a $OUTPUT_FILE
# Pending hintsecho "Pending Hints:" | tee -a $OUTPUT_FILEnodetool listpendinghints 2>/dev/null | tee -a $OUTPUT_FILE
echo "" | tee -a $OUTPUT_FILE
# Hint configurationecho "Configuration:" | tee -a $OUTPUT_FILEgrep -E "hinted_handoff|max_hint" /etc/cassandra/cassandra.yaml 2>/dev/null | tee -a $OUTPUT_FILE
echo "" | tee -a $OUTPUT_FILE
# Assessmentstatus=$(nodetool statushandoff 2>/dev/null)if echo "$status" | grep -q "is running"; then echo "Assessment: Hinted handoff is ENABLED (normal state)" | tee -a $OUTPUT_FILEelse echo "Assessment: Hinted handoff is DISABLED - ACTION REQUIRED" | tee -a $OUTPUT_FILE echo "Recommendation: Re-enable with 'nodetool enablehandoff'" | tee -a $OUTPUT_FILEfiBest Practices
Section titled “Best Practices”Status Monitoring Guidelines
- Regular checks - Include in routine health monitoring
- Cluster consistency - Verify all nodes have the same status
- Verify after changes - Always check status after enable/disable
- Alert on disabled - Set up alerts for "not running" status
- Document changes - Log when and why status was changed
- Compare to config - Ensure runtime matches intended configuration
Disabled Hinted Handoff
If statushandoff shows "not running", investigate immediately:
- Was it intentionally disabled?
- How long has it been disabled?
- Are there any down nodes that would have needed hints?
- Is repair scheduled to restore consistency?
Related Commands
Section titled “Related Commands”| Command | Relationship |
|---|---|
| enablehandoff | Enable hinted handoff |
| disablehandoff | Disable hinted handoff |
| pausehandoff | Pause hint delivery |
| resumehandoff | Resume hint delivery |
| listpendinghints | List pending hints |
| truncatehints | Remove all hints |