nodetool statusbackup
Displays the current status of incremental backup on the node.
Synopsis
Section titled “Synopsis”nodetool [connection_options] statusbackupSee connection options for connection options.
Description
Section titled “Description”nodetool statusbackup reports whether incremental backup is currently enabled on the node. Incremental backup, when enabled, automatically creates hard links to newly flushed SSTables in a backups subdirectory.
This command is essential for:
- Verifying backup configuration
- Troubleshooting backup issues
- Auditing backup status across nodes
- Health check scripts
Output
Section titled “Output”When Enabled
Section titled “When Enabled”runningIncremental backup is active. New SSTables will be linked to the backups directory upon flush.
When Disabled
Section titled “When Disabled”not runningIncremental backup is disabled. No automatic backup links are being created.
Examples
Section titled “Examples”Basic Usage
Section titled “Basic Usage”nodetool statusbackupCluster-Wide Check
Section titled “Cluster-Wide Check”#!/bin/bash# Check backup status across all nodes using SSH
for node in node1 node2 node3; do echo -n "$node: " ssh "$node" "nodetool statusbackup"doneOutput:
node1: runningnode2: runningnode3: not runningUse Cases
Section titled “Use Cases”Verify Backup Configuration
Section titled “Verify Backup Configuration”Confirm incremental backup is properly enabled:
nodetool statusbackup# Expected: runningPre-Maintenance Check
Section titled “Pre-Maintenance Check”Verify backup status before maintenance:
echo "=== Backup Status Check ==="echo "Backup status: $(nodetool statusbackup)"
if [ "$(nodetool statusbackup)" = "running" ]; then echo "Incremental backup is ENABLED"else echo "WARNING: Incremental backup is DISABLED"fiHealth Check Script
Section titled “Health Check Script”Include backup status in node health checks:
#!/bin/bashecho "=== Node Health Check ==="echo "Binary: $(nodetool statusbinary)"echo "Gossip: $(nodetool statusgossip)"echo "Backup: $(nodetool statusbackup)"echo ""
# Alert if backup is unexpectedly disabledif [ "$(nodetool statusbackup)" != "running" ]; then echo "ALERT: Incremental backup is not running!"fiCluster Audit Script
Section titled “Cluster Audit Script”Audit backup status across all nodes:
#!/bin/bashecho "=== Cluster Backup Status Audit ==="echo ""
# Get list of node IPs from local nodetoolnodes=$(nodetool status | grep -E "^UN|^DN" | awk '{print $2}')enabled=0disabled=0
for node in $nodes; do status=$(ssh "$node" "nodetool statusbackup" 2>/dev/null) if [ "$status" = "running" ]; then echo "$node: ENABLED" ((enabled++)) else echo "$node: DISABLED" ((disabled++)) fidone
echo ""echo "Summary: $enabled enabled, $disabled disabled"Understanding Incremental Backup
Section titled “Understanding Incremental Backup”How It Works
Section titled “How It Works”When incremental backup is enabled (running):
- Cassandra monitors memtable flushes
- Each new SSTable gets a hard link created in the
backupsdirectory - Hard links share disk blocks with the original SSTable
- After compaction removes the original, the backup file becomes the sole reference
Backup Directory Structure
Section titled “Backup Directory Structure”/var/lib/cassandra/data/<keyspace>/<table>-<uuid>/├── backups/ # Incremental backups│ ├── nb-1-big-Data.db│ ├── nb-1-big-Index.db│ └── ...└── snapshots/ # Point-in-time snapshots └── <snapshot_tag>/Status Implications
Section titled “Status Implications”| Status | Meaning | New SSTables |
|---|---|---|
running | Backup enabled | Auto-linked to backups/ |
not running | Backup disabled | No backup links created |
Configuration Methods
Section titled “Configuration Methods”Runtime Toggle
Section titled “Runtime Toggle”# Enablenodetool enablebackupnodetool statusbackup # running
# Disablenodetool disablebackupnodetool statusbackup # not runningPersistent Configuration
Section titled “Persistent Configuration”In cassandra.yaml:
incremental_backups: trueRuntime vs Persistent
Section titled “Runtime vs Persistent”| Method | Persistence | Takes Effect |
|---|---|---|
enablebackup / disablebackup | Until restart | Immediately |
cassandra.yaml | Permanent | After restart |
Monitoring Integration
Section titled “Monitoring Integration”Prometheus Exporter
Section titled “Prometheus Exporter”Export status as metric:
#!/bin/bash# Export backup status for Prometheus
status=$(nodetool statusbackup)if [ "$status" = "running" ]; then echo "cassandra_incremental_backup_enabled 1"else echo "cassandra_incremental_backup_enabled 0"fiNagios/Check Script
Section titled “Nagios/Check Script”#!/bin/bashstatus=$(nodetool statusbackup 2>/dev/null)
if [ $? -ne 0 ]; then echo "UNKNOWN - Cannot connect to Cassandra" exit 3fi
if [ "$status" = "running" ]; then echo "OK - Incremental backup is enabled" exit 0else echo "WARNING - Incremental backup is disabled" exit 1fiJSON Health Output
Section titled “JSON Health Output”#!/bin/bash# Output JSON for monitoring systems
backup_status=$(nodetool statusbackup)backup_enabled="false"[ "$backup_status" = "running" ] && backup_enabled="true"
echo "{\"backup_enabled\": $backup_enabled, \"status\": \"$backup_status\"}"Troubleshooting
Section titled “Troubleshooting”Status Shows "not running" Unexpectedly
Section titled “Status Shows "not running" Unexpectedly”If backup should be enabled but shows disabled:
# Check cassandra.yaml settinggrep incremental_backups /etc/cassandra/cassandra.yaml
# Check if runtime disablednodetool statusbackup
# Re-enable if needednodetool enablebackup
# Verifynodetool statusbackupCannot Determine Status
Section titled “Cannot Determine Status”If command fails:
# Check JMX connectivitynodetool info
# Check Cassandra is runningpgrep -f CassandraDaemon
# Check logstail /var/log/cassandra/system.logBackup Files Not Appearing
Section titled “Backup Files Not Appearing”If status is "running" but no backup files:
# Verify statusnodetool statusbackup
# Force a flush to generate SSTablesnodetool flush my_keyspace
# Check backup directoryls -la /var/lib/cassandra/data/my_keyspace/*/backups/Comparing with Snapshots
Section titled “Comparing with Snapshots”| Aspect | Incremental Backup | Snapshot |
|---|---|---|
| Status check | statusbackup | listsnapshots |
| Enable/create | enablebackup | snapshot |
| Disable/clear | disablebackup | clearsnapshot |
| Automatic | Yes (on flush) | No (manual) |
| Point-in-time | No (continuous) | Yes |
| Restoration | Need baseline + incrementals | Self-contained |
Workflow: Verify Backup Strategy
Section titled “Workflow: Verify Backup Strategy”#!/bin/bashecho "=== Backup Strategy Verification ==="echo ""
# Check incremental backup statusecho "1. Incremental Backup Status:"echo " $(nodetool statusbackup)"echo ""
# Check for existing snapshotsecho "2. Existing Snapshots:"nodetool listsnapshots | tail -5echo ""
# Check backup directory sizesecho "3. Backup Directory Sizes:"du -sh /var/lib/cassandra/data/*/*/backups/ 2>/dev/null | head -5echo ""
# Check cassandra.yaml configurationecho "4. Configuration:"echo " cassandra.yaml setting:"grep incremental_backups /etc/cassandra/cassandra.yamlBest Practices
Section titled “Best Practices”Backup Status Monitoring Guidelines
- Regular verification - Check status as part of routine monitoring
- Cluster consistency - Ensure all nodes have same backup configuration
- Include in health checks - Add to monitoring dashboards
- Alert on changes - Notify if backup becomes disabled unexpectedly
- Document expectations - Know which nodes should have backup enabled
- Combine with snapshots - Use both incremental and snapshot backups
Related Commands
Section titled “Related Commands”| Command | Relationship |
|---|---|
| enablebackup | Enable incremental backup |
| disablebackup | Disable incremental backup |
| snapshot | Create point-in-time backup |
| listsnapshots | List existing snapshots |
| clearsnapshot | Remove snapshots |