This guide walks you through diagnosing and fixing common Apache Cassandra issues, from connection failures and high latency to compaction problems and node crashes. You’ll learn a systematic approach to identify the root cause, apply the right fix, and verify that your cluster is healthy again.
What You’ll Need
- Access to the Cassandra nodes via SSH or a terminal
- Cassandra’s
bindirectory in your PATH (or full paths tonodetool,cqlsh, etc.) - Basic familiarity with Linux command line and YAML configuration files
- Cluster credentials (username/password) if authentication is enabled
- Monitoring tools (optional but helpful): Prometheus, Grafana, or at least
topandiostat
Step-by-Step
- Identify the symptom and scope. Start by asking: Is the entire cluster down, or just one node? Are clients getting timeouts, connection refused errors, or slow responses? Check the application logs and note any error messages. This will guide your next steps.
- Check node status with
nodetool status. Run this on any node. It shows each node’s IP, state (UN = Up/Normal, DN = Down/Normal, UJ = Up/Joining, UL = Up/Leaving), and load. If any node is down, check itssystem.logfor crashes or OOM kills. - Verify gossip and ring health. Use
nodetool gossipinfoto see if nodes are exchanging gossip. If a node is unreachable, check network connectivity (firewall, DNS) and Cassandra’slisten_addressandbroadcast_addressincassandra.yaml. - Check for disk space and inode exhaustion. Run
df -handdf -ion each node. Cassandra requires free disk for commit logs and compaction. If disk is full, the node will stop accepting writes. Delete old snapshots (nodetool clearsnapshot) or add capacity. - Inspect JVM heap usage. Run
nodetool statusand look at the “Load” and “Owns” columns. Usenodetool infoto see heap usage. If heap is above 70–80% for long periods, you may need to tuneheap_new_sizeandmax_heap_sizeincassandra-env.sh, or optimize queries to reduce memory pressure. - Examine latency and timeouts. If clients report timeouts, check
nodetool tpstatsfor dropped mutations and pending tasks. High pending counts indicate a bottleneck. Review your consistency level: if it’s QUORUM or ALL, ensure enough replicas are available. Increaseread_request_timeout_in_msorwrite_request_timeout_in_msincassandra.yamlonly after confirming the cause is not a slow disk or overloaded CPU. - Look at compaction and SSTable counts. Run
nodetool compactionstatsandnodetool cfstats(ortablestats). If there are many pending compactions, your disk I/O may be saturated. Checkiostat -xfor high %util. If needed, adjustcompaction_throughput_mb_per_secor switch to a different compaction strategy (e.g., LeveledCompactionStrategy) for write-heavy workloads. - Check for hot partitions or large rows. Use
nodetool tablehistogramsto see partition size distribution. A single huge partition can cause severe latency. Consider redesigning your data model to avoid unbounded growth, or useclusteringcolumns to split data. - Review Cassandra logs. The log file is usually
logs/system.log. Look for ERROR, WARN, or exceptions. Common entries include “Unable to complete request,” “GCInspector,” or “OutOfMemoryError.” Search for the first occurrence of the error to find the root cause. - Test with
cqlsh. Connect locally on the node:cqlsh. Run a simple query. If it fails, the issue may be with authentication, client configuration, or the node itself. If it succeeds, the problem is likely on the client side or network. - Restart the node as a last resort. If nothing else works, perform a rolling restart: stop Cassandra (
systemctl stop cassandraorkill), wait for it to shut down cleanly, then start it again. Avoid restarting all nodes at once; do one at a time to maintain availability.
Common Mistakes
- Ignoring the gossip state. A node can be up but not part of the ring (e.g., in “Leaving” status forever). Always check
nodetool statusandgossipinfo. - Changing timeouts without understanding the cause. Increasing timeouts masks the problem; it does not fix it. Always investigate why the timeout occurs first.
- Running out of disk space on the commit log drive. The commit log is separate from data directories. If it fills, the node will crash. Monitor both locations.
- Using
kill -9to stop Cassandra. This can corrupt data. Always usenodetool stopdaemonor a graceful shutdown. - Forgetting to check for Java version compatibility. Cassandra requires specific Java versions (usually Java 8 or 11). Using the wrong version can cause cryptic errors.
Tips
- Set up monitoring early. Tools like Prometheus + Grafana can show you trends before they become outages. Watch for increasing pending tasks, heap usage, and disk I/O.
- Use
nodetool describeclusterto quickly see the cluster name, snitch, and partitioner. Mismatches here can cause nodes to fail to join. - Keep backups of
cassandra.yamlandcassandra-env.shbefore making changes. Use a version control system. - Test changes in a staging environment first. Especially changes to compaction strategies, timeouts, or JVM settings.
- Regularly run
nodetool repairto fix anti-entropy. This prevents data inconsistencies that can cause read timeouts.
Troubleshooting
If the steps above don’t resolve the issue, try these additional checks:
- If a node fails to start: Look at the
system.logfor the exact exception. Common causes include incorrect file permissions on data directories, a full disk, or a port conflict (e.g., 7000, 9042). Usenetstat -tulpnto check. - If clients can’t connect: Verify that
rpc_addressandbroadcast_rpc_addressare set correctly. Check firewall rules for port 9042. Test withtelnet.9042 - If performance is terrible: Check for GC pauses by enabling GC logging. Use
nodetool gcstatsto see recent GC activity. If you see long pauses, reduce heap usage or adjust GC settings. - If data is inconsistent: Run
nodetool repair -pron each node. If repair fails, check for disk errors or network issues between replicas. - If all else fails: Consult the Cassandra mailing lists or Stack Overflow, providing your
system.logandcassandra.yaml(with secrets redacted).
Frequently Asked Questions
Why is my Cassandra node down?
Check nodetool status to see the state. If it’s DN, look at the system log for crashes, OOM, or disk full errors. Also check if the node was decommissioned accidentally.
How do I fix a node that is stuck in “Joining” state?
This often happens due to a mismatch in the cluster name, snitch, or seed list. Verify these in cassandra.yaml. Also ensure the node can communicate with the seed nodes on port 7000.
What does “Unable to complete request: timeout” mean?
It means the coordinator didn’t receive a response from replicas within the configured timeout. This could be due to slow disks, overloaded nodes, or a large partition. Use nodetool tpstats and tablehistograms to diagnose.
Should I increase timeouts to fix timeouts?
Only as a temporary measure. Increasing timeouts can hide underlying issues like data model problems or insufficient hardware. Fix the root cause first.
How can I tell if a node has disk I/O problems?
Run iostat -x 1 and look at the %util. If it’s consistently above 80%, the disk is a bottleneck. Also check nodetool compactionstats for pending compactions.
Why is my write latency high even with low load?
Check if you’re using a consistency level of ALL or QUORUM with only a few replicas. Also check for large partitions or frequent compactions. Use nodetool proxyhistograms to see where time is spent.
Related
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.
More cards in this drawer
- Campus Tech Innovation Hubs: What They Are
- Poco C51 Airtel Prepaid Locked Variant India?
- Jenkins vs GitHub Actions: Which CI/CD Fits Your Team?
- Turn Off Backup Encryption in iTunes?
- Shared VPS Hosting: Is It Better?
- Disk Defrag Pro: What It Does and Whether You Need It