nodetool failuredetector
Displays the failure detector information for the cluster.
Synopsis
Section titled “Synopsis”nodetool [connection_options] failuredetectorSee connection options for connection options.
Description
Section titled “Description”nodetool failuredetector displays information about Cassandra's failure detector, which monitors the health of nodes in the cluster using the Phi Accrual Failure Detector algorithm. This information helps understand how the cluster perceives node health and connectivity.
The failure detector uses gossip heartbeats to calculate a "phi" value representing the likelihood that a node has failed. When phi exceeds the configured threshold, the node is marked as down.
Examples
Section titled “Examples”Basic Usage
Section titled “Basic Usage”nodetool failuredetectorOutput
Section titled “Output”Sample Output
Section titled “Sample Output”Endpoint,Phi192.168.1.101,0.0034521192.168.1.102,0.0028934192.168.1.103,0.0041256192.168.1.104,5.2341567Note: Output is in CSV format with comma-separated values.
Interpreting Phi Values
Section titled “Interpreting Phi Values”| Phi Value | Interpretation |
|---|---|
| 0 - 0.5 | Very healthy, recent heartbeat |
| 0.5 - 5 | Healthy, normal range |
| 5 - 8 | Elevated, possible issues |
| > 8 | Likely down (default threshold) |
Failure Detection Algorithm
Section titled “Failure Detection Algorithm”Phi Accrual Failure Detector
Section titled “Phi Accrual Failure Detector”How Phi is Calculated:
1. Each node sends periodic heartbeats via gossip2. Receiving nodes track heartbeat arrival times3. Statistical analysis calculates expected arrival time4. Phi = -log10(P(heartbeat will still arrive))5. Higher phi = higher probability of failureDefault Threshold
Section titled “Default Threshold”phi_convict_threshold: 8A node is marked DOWN when phi exceeds this threshold.
Use Cases
Section titled “Use Cases”Diagnose Cluster Health
Section titled “Diagnose Cluster Health”# Check all nodes' phi valuesnodetool failuredetector
# Identify nodes with elevated phinodetool failuredetector | awk '$2 > 1 {print}'Network Issue Investigation
Section titled “Network Issue Investigation”When experiencing intermittent connectivity:
# Monitor phi values over timewatch -n 5 'nodetool failuredetector'Pre-Maintenance Check
Section titled “Pre-Maintenance Check”Before cluster operations:
# Ensure all nodes are healthynodetool failuredetector
# All phi values should be lowMonitoring Script
Section titled “Monitoring Script”#!/bin/bashTHRESHOLD=5.0
echo "=== Failure Detector Check ==="echo ""
# Get failure detector infonodetool failuredetector | tail -n +2 | while read endpoint phi; do # Compare phi to threshold elevated=$(echo "$phi > $THRESHOLD" | bc -l)
if [ "$elevated" -eq 1 ]; then echo "WARNING: $endpoint has elevated phi: $phi" else echo "OK: $endpoint phi=$phi" fidoneCluster-Wide Check
Section titled “Cluster-Wide Check”#!/bin/bashecho "=== Cluster Failure Detector Status ==="
# Get list of node IPs from local nodetool statusnodes=$(nodetool status | grep "^UN\|^DN" | awk '{print $2}')
for node in $nodes; do echo "" echo "=== From perspective of $node ===" ssh "$node" "nodetool failuredetector 2>/dev/null || echo 'Cannot connect to $node'"doneTroubleshooting
Section titled “Troubleshooting”High Phi Values
Section titled “High Phi Values”If a node shows consistently high phi:
# Check network connectivityping <node_ip>
# Check if node is under loadssh <node_ip> "nodetool tpstats"
# Check for GC issuesssh <node_ip> "nodetool gcstats"Fluctuating Phi Values
Section titled “Fluctuating Phi Values”Indicates network instability:
# Check for network issuestraceroute <node_ip>
# Monitor over timefor i in {1..60}; do echo "$(date): $(nodetool failuredetector | grep <node_ip>)" sleep 10doneNode Incorrectly Marked Down
Section titled “Node Incorrectly Marked Down”If a healthy node is marked down:
# Check phi thresholdgrep phi_convict_threshold /etc/cassandra/cassandra.yaml
# Consider adjusting if network is high-latency# Higher threshold = more tolerant of delaysConfiguration
Section titled “Configuration”Phi Threshold
Section titled “Phi Threshold”phi_convict_threshold: 8 # Default
# For high-latency networks, consider increasing:# phi_convict_threshold: 12Affecting Factors
Section titled “Affecting Factors”| Factor | Effect on Phi |
|---|---|
| Network latency | Higher latency → higher phi |
| GC pauses | Long GC → spikes in phi |
| CPU load | High load → delayed heartbeats |
| Network packet loss | Missing heartbeats → elevated phi |
Best Practices
Section titled “Best Practices”Failure Detector Guidelines
- Regular monitoring - Include in health checks
- Baseline values - Know normal phi ranges for your cluster
- Alert on elevated phi - Before nodes are marked down
- Investigate spikes - Don't ignore temporary elevations
- Tune threshold - Adjust for network characteristics
Healthy Cluster Indicators
- All phi values < 1.0
- Values stable over time
- No sudden spikes
- Symmetric across nodes (A sees B same as B sees A)
Related Commands
Section titled “Related Commands”| Command | Relationship |
|---|---|
| gossipinfo | Detailed gossip state |
| status | Cluster status overview |
| info | Node information |
| netstats | Network statistics |