Master Nodetool
Your Swiss Army knife for Cassandra cluster administration!
๐ง What is Nodetool?
Nodetool = Your cluster management Swiss Army knife!
It's THE command-line tool for managing and monitoring Cassandra clusters. Think of it as:
- ๐ง Administrator's toolkit for cluster operations
- ๐ Monitoring dashboard in your terminal
- ๐ Debugging tool for investigating issues
- ๐พ Backup manager for snapshots
- ๐ฅ Health checker for cluster status
โจ What You Can Do
- โ Check cluster health: Node status, ring topology
- โ Maintenance tasks: Repair, compact, flush, cleanup
- โ Monitor performance: Stats, metrics, thread pools
- โ Manage nodes: Add, remove, decommission, rebuild
- โ Backup/restore: Snapshots, incremental backups
- โ Tune settings: Cache, compaction, streaming
๐ฏ When to Use Nodetool
- ๐ Daily: Check cluster status
- ๐ง Weekly: Run repairs, check stats
- ๐จ Troubleshooting: Investigate issues, view logs
- โ Scaling: Add/remove nodes
- ๐พ Backups: Create snapshots
- โก Performance: Analyze bottlenecks
๐ Master nodetool = Master Cassandra operations!
Running Nodetool
โญ Essential Commands - Use These Daily
The commands you'll use most often!
๐ฅ nodetool status
THE most important command! Shows cluster health.
โน๏ธ nodetool info
Detailed node information
๐ nodetool describecluster
Cluster overview
๐ nodetool ring
Token ring distribution
๐ nodetool version
Check Cassandra version
๐ง Maintenance Commands
Keep your cluster healthy!
nodetool repair
CRITICAL: Ensures data consistency across replicas
โฑ๏ธ Time: Can take minutes to hours depending on data size
๐ Schedule: Weekly for critical data, monthly for non-critical
nodetool compact
Merge SSTables to reclaim space and improve performance
โ ๏ธ Warning: Use sparingly! Compaction happens automatically
๐ก When to use: After bulk deletes, when disk is low
nodetool cleanup
Remove data this node no longer owns (after adding nodes)
๐ฏ Purpose: Reclaim disk space after cluster expansion
๐ When: After adding new nodes to cluster
nodetool flush
Write memtables to disk immediately
๐ก When to use: Before backups, before shutdown, testing
โก Fast: Usually completes in seconds
Maintenance Best Practices
- โ Repair: Run weekly on production clusters
- โ ๏ธ Compact: Only when necessary (not routinely)
- โ Cleanup: Always after adding nodes
- โ Flush: Before backups and shutdowns
- โ ๏ธ I/O Impact: These operations use disk heavily
- ๐ก Scheduling: Run during low-traffic periods
๐ Monitoring Commands
Monitor performance and health!
๐ nodetool tablestats
Table-level statistics
๐งต nodetool tpstats
Thread pool statistics
๐ nodetool proxyhistograms
Latency histograms
๐๏ธ nodetool cfstats
Column family (table) statistics - Detailed
๐ nodetool compactionstats
Active compactions
๐พ nodetool getlogginglevels
View current log levels
๐ Cluster Operations
Scale and manage your cluster!
nodetool decommission
CRITICAL: Gracefully remove a node
NEVER Skip Decommission!
Always decommission before removing a node!
- โ Correct: decommission โ wait โ stop node
- โ Wrong: Just stop/kill node
- โ ๏ธ Skipping = permanent data loss!
nodetool removenode
Force remove a dead node (emergency only!)
โ ๏ธ Use only when:
- Node is permanently dead
- Can't run decommission on it
- Hardware failure, etc
nodetool rebuild
Stream data from another datacenter
nodetool gossipinfo
View gossip state
๐พ Backup Commands
Protect your data!
nodetool snapshot
Create point-in-time backup
nodetool clearsnapshot
Delete old snapshots
Backup Strategy
Recommended approach:
- Daily snapshots: Automated with cron
- Copy to S3/Object Storage: Off-server backup
- Test restores: Verify backups work
- Retention: Keep 7-30 days
- Monitor disk: Snapshots use space!
๐ Troubleshooting Commands
Debug issues quickly!
๐ Quick Health Check
๐ Slow Queries
๐พ High Disk Usage
๐ง High Memory Usage
๐ Node Not Joining Cluster
๐ก Best Practices
Use nodetool like a pro!
DO
- Run
statusdaily - Schedule weekly repairs
- Take daily snapshots
- Monitor
tpstats - Always decommission nodes
- Use
-Hfor human sizes - Check logs after commands
DON'T
- Run compact routinely
- Skip decommissioning
- Ignore high pending counts
- Forget to clear snapshots
- Run repairs too frequently
- Force commands without checking
- Ignore schema disagreements
Maintenance Schedule
Recommended routine:
- Daily: Check
nodetool status - Daily: Take snapshots (automated)
- Weekly: Run
nodetool repair - Weekly: Check
tablestats,tpstats - Monthly: Clean up old snapshots
- After scaling: Run
cleanup - Before upgrades: Take snapshot, run
flush
๐ You're a Nodetool Expert!
Congratulations! You now know how to use nodetool effectively!
๐ What You Learned:
- โญ Essential commands: status, info, describecluster, ring
- ๐ง Maintenance: repair, compact, cleanup, flush
- ๐ Monitoring: tablestats, tpstats, proxyhistograms
- ๐ Cluster ops: decommission, removenode, rebuild
- ๐พ Backups: snapshot, clearsnapshot, listsnapshots
- ๐ Troubleshooting: Debug common issues
- ๐ก Best practices: Maintenance schedules, DO/DON'T
๐ก Essential Commands Cheat Sheet:
๐ง Nodetool is your best friend for Cassandra operations!
Responsive Ad