Apache Cassandra
TwinCommit captures changes from Apache Cassandra by reading the CDC commit log segments each node writes for CDC-enabled tables. Because every replica records the same mutation, TwinCommit deduplicates mutations across nodes by partition key, clustering key and write timestamp before applying them.
Supported: Apache Cassandra 4.0, 4.1 and 5.0 · DataStax Enterprise 6.8 and 6.9.
Prerequisites
Section titled “Prerequisites”Enable CDC on each node
Section titled “Enable CDC on each node”cdc_enabled: truecdc_raw_directory: /var/lib/cassandra/cdc_rawcdc_total_space: 4096MiBcdc_on_repair_enabled: trueRestart each node after changing cassandra.yaml.
Enable CDC on each table
Section titled “Enable CDC on each table”ALTER TABLE app.orders WITH cdc = true;Agent placement
Section titled “Agent placement”Cassandra writes CDC segments to local disk, so TwinCommit runs a lightweight reader on every node (twincommit run -role cassandra-reader). Each reader forwards mutations to the pipeline process, which deduplicates and applies them. Deploy the readers as a DaemonSet on Kubernetes or as a systemd unit on VMs.
CREATE ROLE twincommit WITH LOGIN = true AND PASSWORD = '********';GRANT SELECT ON KEYSPACE app TO twincommit;GRANT DESCRIBE ON ALL KEYSPACES TO twincommit;Configuration
Section titled “Configuration”source: type: cassandra contact_points: [cass-1.internal, cass-2.internal, cass-3.internal] local_dc: dc1 user: twincommit password: ${CASSANDRA_PASSWORD} readers: 3 # number of node readers expectedHow capture works
Section titled “How capture works”- Each node reader tails
cdc_raw_directory, parses committed segments, and deletes segments after the pipeline acknowledges them. - The pipeline merges the streams from every node, keeps the first copy of each mutation and orders them by write timestamp.
- Cassandra has no multi-partition transactions. Each mutation is applied as its own unit, and a
LOGGED BATCHis applied atomically.
Limitations
Section titled “Limitations”- Counter tables and materialized views are not captured. Capture the base table instead.
- If
cdc_total_spacefills because readers are down, Cassandra rejects writes to CDC tables. Alert ontwincommit_lag_secondsand on free CDC space. - Lightweight transactions are captured as their final committed mutation.