Operating Apache Cassandra: Repair, Backups, and Compaction
Operate Apache Cassandra 5.0.9 with workload-aware repair and compaction, tested backups, practical monitoring signals, and a safe incident workflow.
This operations guide covers repair, compaction, backup and restore, and the signals that help explain Cassandra cluster health. It targets Apache Cassandra 5.0.9 and avoids universal schedules or alert thresholds because topology and workload determine the right operating plan.
Operating Apache Cassandra: Repair, Backups, and Compaction
This companion covers day-to-day production work: keeping replicas reconciled, understanding compaction pressure, and proving that backups can be restored. It targets Apache Cassandra 5.0.9; the release page and documentation were checked on 2026-11-04. For table design and query patterns, start with the main Cassandra guide. The sections below link to the Cassandra 5.0.9 repair documentation, compaction documentation, and the Apache Cassandra release page.
Plan repair around data risk and cluster capacity
Repair reconciles replica data for shared token ranges. Nodes can miss writes while unavailable, and hinted handoff is best effort. If replicas remain divergent, the difference can surface when nodes return, data is replaced, or tombstones expire. Repair compares replica datasets and streams differences; it is an operator-run task because it can consume disk and network I/O.
An incremental repair covers data written since the previous incremental repair. Cassandra 5.0 uses incremental repair by default. It can reduce the work of a regular repair program, but marking data repaired means a later incremental run does not revisit that data. It is not a general integrity check for disk corruption, operator mistakes, or software defects. Full repair revisits the selected ranges and should remain part of a plan where those risks matter.
There is no safe schedule that applies to every cluster. Set coverage goals using each table’s gc_grace_seconds, replica topology, node availability, write volume, and the time your cluster can spend streaming and validating data. The repair plan must cover all relevant ranges and data centers before the applicable tombstone grace window expires. Measure a representative repair, confirm it finishes, then set a cadence and alert on missed or incomplete coverage. Treat a repair that continually falls behind as a capacity or scheduling problem; overlapping many repairs can add pressure instead of catching up.
For a controlled start, inspect node state and current streaming or repair work before launching a task. Cassandra 5.0 supports previewing estimated repair streaming and validating repaired data without streaming changes. These are useful when investigating suspected divergence. Use a primary-range repair plan across the intended nodes rather than assuming one nodetool repair invocation repairs the whole cluster. Read the repair options and coverage notes before choosing flags for your topology.
Repair does not replace a backup. It copies replica data to reconcile the cluster; it cannot recover a table dropped everywhere, undo an application bug, or restore an earlier point in time.
Treat compaction as planned I/O work
Cassandra writes immutable SSTables. Updates, deletes, and expired TTL data can leave multiple versions across files. Compaction merges SSTables, resolves versions, and may discard obsolete data when it is safe. That can reduce the work reads do and reclaim disk space, but compaction itself uses CPU and disk I/O. During a rewrite, input files and output files can coexist, so available disk headroom matters.
Pick and tune compaction for the table’s access pattern, update behavior, TTL use, storage, and acceptable resource contention. Cassandra 5.0 recommends Unified Compaction Strategy (UCS) for most new workloads, while the other strategies remain available for specific tradeoffs. For example, the official documentation describes Time Window Compaction Strategy for timestamp-grouped and expiring data, and Leveled Compaction Strategy for read-heavy workloads; those properties do not make either strategy a universal choice. Validate the behavior on representative data before changing a production table. See the versioned pages for UCS, TWCS, and LCS.
When compaction cannot keep pace, inspect which tables have pending work, current progress, disk space, and host I/O before adjusting concurrency or throughput. nodetool compactionstats reports active and pending compactions; Cassandra also exposes table compaction metrics. A rising backlog is a signal to investigate workload and resources, not by itself a reason to trigger a major compaction. A large manual rewrite can increase I/O and temporary disk demand. Avoid disabling automatic compaction as a blanket mitigation; if you must change behavior, document the table, reason, rollback, and re-enable plan.
Compaction will not correct a poor data model. A hot partition, oversized partition, or query that scans more data than intended needs a schema or query-path change. Review the Cassandra data-modeling guidance before trying to compensate with compaction settings.
Keep backups independent and test restoration
Cassandra supports snapshots and incremental backups. A snapshot records SSTable files at a point in time and includes schema information. Incremental backup files do not include table DDL, so retain the matching schema when planning a restore. The Cassandra 5.0.9 backup guide describes both mechanisms and restore options.
A node-local snapshot is useful, but it is not a recovery plan by itself. Copy backup material to storage independent of the source node or cluster, protect it with the same access controls as production data, and record which schema and backup set belong together. Define recovery point and recovery time objectives from the application’s needs; Cassandra does not choose those for you.
Run a restore rehearsal into an isolated compatible cluster before relying on the backup. Restore the schema, load the selected snapshot or incremental files using the documented method, and verify that the cluster can serve application queries. Check application-level invariants as well as whether files loaded: compare expected records or aggregates, exercise representative reads and writes where safe, and record the time and manual steps required. Repeat after changes to backup tooling, schema, or Cassandra version. A backup is only useful if the team can identify the right set and complete a tested restore.
Monitor trends against workload baselines
Cassandra metrics are reported per node and should be aggregated in an external monitoring system. Establish alert thresholds from your service objectives, normal workload, topology, and recovery capacity. Avoid copying a threshold from another cluster; the same value can mean different things on different hardware and data models. The official Cassandra 5.0.9 monitoring reference lists available metrics and their scope.
Start with a small set of signals that help distinguish workload pressure from node or maintenance problems:
| Area | Signals to trend | What a change can help you investigate |
|---|---|---|
| Node and disk | Node state, disk usage, available disk, host I/O | Unavailable nodes, growing data, or storage contention |
| Client requests | Read/write latency distributions, timeouts, failures, dropped messages | Changes in client load, replica availability, or coordinator pressure |
| Compaction | Pending tasks, active progress, bytes written, per-table SSTable counts | Whether compaction is keeping up and which tables contribute work |
| Repair and streaming | Repair completion, streamed bytes, hint backlog or delivery failures | Unreconciled ranges, a recovering node, or maintenance contention |
| Table behavior | Tombstone warnings, partition-size estimates, read amplification indicators | A query or data-shape problem that may need modeling changes |
Use Cassandra metrics with host-level CPU, disk latency, memory, and network measurements. Correlate a change with deployments, traffic shifts, node replacements, repair windows, and compaction activity. Compare distributions and trends against the same workload period instead of relying on a single cluster-wide average. For broader instrumentation practices, see database monitoring and the backup and recovery guide.
A safe incident workflow
When the cluster degrades, make the smallest decision that preserves options:
- Scope the impact. Check client errors, node status from more than one observer, recent changes, and whether the issue affects a table, node, rack, or data center. Preserve logs and metric snapshots before restarting or clearing state.
- Protect remaining capacity. Identify disk pressure, saturated I/O, ongoing streaming, compaction backlog, and repair activity. Pause optional maintenance only when you understand its effect and have an explicit restart plan. Do not start broad repair or manual compaction just because latency is high.
- Choose an action that matches the symptom. Use repair to reconcile replica divergence after verifying range coverage and capacity. Use backup restore for data loss or a bad write that reached replicas. Investigate query and table design when the evidence points to hot partitions or excess scanning. Compaction addresses SSTable organization; it does not correct application data or schema decisions.
- Change one thing and watch it. Record the command, target, expected effect, and rollback. Monitor request failures, disk and I/O pressure, repair/compaction progress, and replica health while the change runs. Stop or roll back if the cluster loses more headroom.
- Verify recovery with the application. Confirm affected queries and invariants, not only node status. Check that required repair coverage or backup restore validation is complete, and write down remaining risks before closing the incident.
Keep this sequence in the runbook for the cluster, with owners, access paths, and escalation contacts filled in. Pair it with recovery drills so a production incident is not the first time anyone has tried to restore the data.
Conclusion
Before calling the cluster healthy, check that repair covers replica ranges within each table’s gc_grace_seconds window and that a recent backup restores in isolation. Set alert limits from observed workload and recovery goals. If repair and compaction progress look normal but queries still struggle, revisit the access patterns in the main Cassandra guide.
Category
Related Posts
DynamoDB Operations: Capacity, Backups, and Recovery
Choose a DynamoDB capacity mode, diagnose throttling, and plan backup and recovery steps with current AWS guidance for your workload.
Apache Cassandra Data Modeling: A Customer Orders Table
Design a customer-orders table in Apache Cassandra 5.0.9 with month-bucketed partitions, a runnable CQL lab, and an honest read/write quorum tradeoff.
Quality Attributes and Architecture Trade-offs
Turn goals like reliability, security, and performance into measurable scenarios, then compare architectural choices with explicit costs and constraints.