molt replicator
Continuous change-data-capture (CDC) replication from source databases to CockroachDB. Run after molt fetch completes the initial bulk load.
Important: replicator is a separate binary from
molt. It is not invoked bymolt fetch. Thedata-load-and-replicationmode in molt fetch is deprecated — use replicator directly instead.
Architecture
Replicator reads changes from the source, buffers them in a staging schema on the target CRDB cluster, and applies them to the target tables.
Subcommands by Source
Full Fetch → Replicator Workflow
Step 1: Initial bulk load with molt fetch
drop-on-target-and-recreate drops any existing target tables first; run this only against a fresh or empty target.
Step 2: Create publication on source (PostgreSQL)
Step 3: Create staging database on target
Step 4: Test connectivity
Step 5: Start replicator
Step 6: Monitor lag
Step 7: Cutover
- When lag reaches ~0, redirect app writes to CockroachDB
- Let replicator drain remaining changes
- Confirm no new writes on source
- Stop replicator
- Decommission the source only after
molt verifypasses and a source backup is confirmed
Source-Specific Setup
PostgreSQL (pglogical)
Source prerequisites:
- User with
REPLICATIONprivilege - Logical replication enabled (
wal_level = logical) - Publication exists (created by
molt fetchor manually)
MySQL (mylogical)
Source prerequisites:
- Binary logging enabled (
binlog_format = ROW) - GTID mode on (
gtid_mode=ON,enforce_gtid_consistency=ON) - User with
REPLICATION CLIENTprivilege
Oracle (oraclelogminer)
Source prerequisites:
- Archive log mode enabled
- Supplemental logging enabled
- LogMiner permissions granted
Key Flags
Gotchas
- Staging schema (
_replicator.public) is auto-created by replicator, but the database (_replicator) must exist first --publicationNameand--slotNamemust match whatmolt fetchcreated.molt fetch's--pglogical-publication-namedefaults tomolt_fetchand its--pglogical-replication-slot-namehas no default; on the replicator side,--publicationNamehas no default and--slotNamedefaults toreplicator. If the names don't line up, set both explicitly on both sides.- DLQ table grows over time — monitor and purge failed rows periodically
- Replicator holds an open replication slot on the source — this blocks WAL cleanup; monitor source disk usage
- Graceful shutdown respects
--gracePeriod(default: 30s); don't SIGKILL without it - No built-in alerting — set up external alerts on the Prometheus metrics endpoint
- Long cutover windows increase replication lag — plan for a maintenance window if needed
See flags reference [blocked] for the full flag list.


