nodetool truncatehints
Removes all pending hints from this node.
Synopsis
Section titled “Synopsis”nodetool [connection_options] truncatehints [endpoint]See connection options for connection options.
Description
Section titled “Description”nodetool truncatehints deletes stored hints on this node. Hints are writes stored temporarily when a replica is unavailable, to be replayed when the replica recovers. Truncating hints discards these pending writes.
Arguments
Section titled “Arguments”| Argument | Description |
|---|---|
endpoint | Optional. Only truncate hints for this specific endpoint IP |
Examples
Section titled “Examples”Truncate All Hints
Section titled “Truncate All Hints”nodetool truncatehintsTruncate Hints for Specific Node
Section titled “Truncate Hints for Specific Node”nodetool truncatehints 192.168.1.105When to Use
Section titled “When to Use”Node Permanently Removed
Section titled “Node Permanently Removed”When a node is removed and won't return:
# After removing node 192.168.1.105nodetool truncatehints 192.168.1.105Hints for removed nodes will never be delivered.
Hint Backlog Too Large
Section titled “Hint Backlog Too Large”When hints have accumulated excessively:
# Check hint statusnodetool tpstats | grep -i hint
# If backlog is causing issuesnodetool truncatehintsReplace Node Scenario
Section titled “Replace Node Scenario”When replacing a node (new node, same IP):
# Truncate hints for the old nodenodetool truncatehints 192.168.1.105
# Then add replacement nodeWhen NOT to Use
Section titled “When NOT to Use”Data Loss Warning
Truncating hints means:
- Pending writes will NOT be delivered
- Data may become inconsistent
- Only use when recovery isn't possible or desired
Don't Use When
Section titled “Don't Use When”- Node is temporarily down and will recover
- You want to preserve data consistency
- During normal operations
Understanding Hints
Section titled “Understanding Hints”What Hints Contain
Section titled “What Hints Contain”When a write fails to reach a replica:
- Coordinator stores the write as a "hint"
- Hint includes: mutation data + target endpoint
- When target recovers, hints are replayed
Hint Location
Section titled “Hint Location”Hints are stored in:
/var/lib/cassandra/hints/Check Pending Hints
Section titled “Check Pending Hints”# See hint delivery statusnodetool tpstats | grep -i hint
# List hint filesls -la /var/lib/cassandra/hints/Impact of Truncation
Section titled “Impact of Truncation”| Scenario | Impact |
|---|---|
| Target node returns | Missed writes not recovered (run repair) |
| Target node replaced | Old hints not needed anyway |
| Target node removed | Hints would never deliver |
Recovery After Truncation
Section titled “Recovery After Truncation”If hints are truncated but data consistency is needed:
# Run repair to restore consistencynodetool repair -pr keyspaceHint Configuration
Section titled “Hint Configuration”Related settings in cassandra.yaml:
| Setting (4.1+) | Setting (Pre-4.1) | Default | Description |
|---|---|---|---|
max_hint_window | max_hint_window_in_ms | 3h / 10800000 | Stop hinting after this duration |
hinted_handoff_enabled | hinted_handoff_enabled | true | Whether hints are created |
hints_directory | hints_directory | $DATA/hints | Hint storage location |
Workflow: Decommission with Hints
Section titled “Workflow: Decommission with Hints”# 1. Check if node has pending hintsnodetool tpstats | grep -i hint
# 2. If removing node permanently, truncate its hintsnodetool truncatehints <removed_node_ip>
# 3. Run repair to ensure consistencynodetool repair -prMonitoring Hints
Section titled “Monitoring Hints”Before Truncation
Section titled “Before Truncation”# Check hint backlognodetool tpstats | grep HintedHandoff
# Check hint files sizedu -sh /var/lib/cassandra/hints/After Truncation
Section titled “After Truncation”# Verify hints removedls -la /var/lib/cassandra/hints/
# Confirm emptynodetool tpstats | grep HintedHandoffCommon Scenarios
Section titled “Common Scenarios”Scenario 1: Long-Down Node
Section titled “Scenario 1: Long-Down Node”Node has been down for days:
# Check hints accumulateddu -sh /var/lib/cassandra/hints/
# If node won't return, truncatenodetool truncatehints 192.168.1.105
# Run repair on recovered node insteadScenario 2: Hint Disk Full
Section titled “Scenario 2: Hint Disk Full”Hints filling disk:
# Emergency truncationnodetool truncatehints
# Then run repairsnodetool repair -prScenario 3: Node Replacement
Section titled “Scenario 3: Node Replacement”Replacing dead node with new hardware:
# Truncate hints for old nodenodetool truncatehints 192.168.1.105
# Bootstrap new node with same tokens# Run repair after bootstrapBest Practices
Section titled “Best Practices”Hint Management
- Prefer repair over truncation - Repair recovers data properly
- Truncate only for removed nodes - Hints to removed nodes are useless
- Monitor hint growth - Large hint backlogs indicate problems
- Repair after truncation - Restore consistency
- Consider max_hint_window - Tune to match your SLA
Related Commands
Section titled “Related Commands”| Command | Relationship |
|---|---|
| tpstats | Check hint delivery status |
| repair | Restore consistency after truncation |
| removenode | Remove dead nodes (truncate hints after) |
| decommission | Graceful node removal |