Terminology
- Checkpoint: The position in the source database’s transaction log from which replication begins or resumes: LSN (PostgreSQL), GTID (MySQL), or SCN (Oracle).
- Staging database: A CockroachDB database used by Replicator to store replication metadata, checkpoints, and buffered mutations. Specified with and automatically created with . For details, refer to Staging database.
- Forward replication: Replicate changes from a source database (PostgreSQL, MySQL, or Oracle) to CockroachDB during a migration. For usage details, refer to Forward replication (after initial load).
- Failback: Replicate changes from CockroachDB back to the source database. Used for migration rollback or to maintain data consistency on the source during migration. For usage details, refer to Failback replication.
Prerequisites
Supported databases
MOLT Replicator supports the following source and target databases:- PostgreSQL 11-16
- MySQL 5.7-8.4
- Oracle Database 19c (Enterprise Edition) and 21c (Express Edition)
- CockroachDB (all currently )
Database configuration
The source database must be configured for replication:| Database | Configuration Requirements | Examples |
|---|---|---|
| PostgreSQL source |
| |
| MySQL source |
| |
| Oracle source |
| |
| CockroachDB source (failback) |
|
User permissions
The SQL user running MOLT Replicator requires specific privileges on both the source and target databases:| Database | Required Privileges | Examples |
|---|---|---|
| PostgreSQL source |
| |
| MySQL source |
| |
| Oracle source |
| |
| CockroachDB target (forward replication) |
| |
| PostgreSQL, MySQL, or Oracle target (failback) |
|
How it works
MOLT Replicator supports forward replication from PostgreSQL, MySQL, and Oracle, and failback from CockroachDB:- PostgreSQL source (): MOLT Replicator uses PostgreSQL logical replication, which is based on publications and replication slots. You create a publication for the target tables, and a slot marks consistent replication points. MOLT Replicator consumes this logical feed directly and applies the data in sorted batches to the target.
- MySQL source (): MOLT Replicator relies on MySQL GTID-based replication to read change data from MySQL binlogs. It works with MySQL versions that support GTID-based replication and applies transactionally consistent feeds to the target. Binlog features that do not use GTIDs are not supported.
- Oracle source (): MOLT Replicator uses Oracle LogMiner to capture change data from Oracle redo logs. Both Oracle Multitenant (CDB/PDB) and single-tenant Oracle architectures are supported. Replicator periodically queries LogMiner-populated views and processes transactional data in ascending SCN windows for reliable throughput while maintaining consistency.
- Failback from CockroachDB (): MOLT Replicator acts as an HTTPS for a single CockroachDB changefeed. Replicator receives mutations from source cluster nodes, can optionally buffer them in a CockroachDB staging cluster, and then applies time-ordered transactional batches to the target database. Mutations are applied as or statements while respecting and table dependencies.
Replicator commands
MOLT Replicator provides four commands for different replication scenarios. For example commands, refer to Common uses. Usepglogical to replicate from PostgreSQL to CockroachDB:
mylogical to replicate from MySQL to CockroachDB:
oraclelogminer to replicate from Oracle to CockroachDB:
start to replicate from CockroachDB to PostgreSQL, MySQL, or Oracle (failback):
Source connection strings
specifies the connection string of the source database for forward replication.The source connection string must point to the primary instance of the source database. Replicas cannot provide the necessary replication checkpoints and transaction metadata required for ongoing replication.
Target connection strings
specifies the connection string of the target CockroachDB database for forward replication:For failback, specifies the original source database (PostgreSQL, MySQL, or Oracle). For details, refer to Failback replication.
Replication checkpoints
MOLT Replicator requires a checkpoint value to start replication from the correct position in the source database’s transaction log. For PostgreSQL, use to specify the . The slot automatically tracks the LSN (Log Sequence Number):Staging database
The staging database stores replication metadata, checkpoints, and buffered mutations. Specify the staging database with in fully-qualifieddatabase.schema format and create it automatically with :
- Store checkpoints that enable resuming from the correct point after interruptions.
- Buffer mutations before applying them to the target in transaction order.
- Maintain consistency for time-ordered transactional batches while respecting table dependencies.
- Provide restart capabilities after failures.
Consistency modes
Consistency modes control how MOLT Replicator balances throughput and transactional guarantees.Failback mode (CockroachDB source)
When using thestart command to replicate from CockroachDB to another database, you can configure one of the following consistency modes:
- Consistent (default): Preserves per-row order and source transaction atomicity. Mutations are buffered in memory and are flushed out to the target database when is reached or once has passed since the previous flush. Concurrent transactions are controlled by .
-
BestEffort: Relaxes atomicity across tables that do not have foreign key constraints between them (maintains coherence within FK-connected groups). Mutations are buffered in memory and are flushed out to the target database when is reached or once has passed since the previous flush. Enable with or allow auto-entry via set to a positive duration (such as
1s).For independent tables (with no foreign key constraints), BestEffort mode applies changes immediately as they arrive, without waiting for the resolved timestamp. This provides higher throughput for tables that have no relationships with other tables. - Immediate: Applies updates as they arrive to Replicator with no buffering or waiting for resolved timestamps. Enable with . Provides highest throughput but requires no foreign keys on the target schema.
Forward replication (PostgreSQL, MySQL, Oracle sources)
When usingpglogical, mylogical, or oraclelogminer commands to replicate from PostgreSQL, MySQL, or Oracle sources to CockroachDB, Replicator always preserves per-row order and source transaction atomicity for any changes. This behavior cannot be configured. The consistency mode flags (, , ) do not apply to these commands and will have no effect if specified.
Userscripts
MOLT Replicator can apply userscripts, specified with the , to customize how data is processed and transformed as it moves through the live replication pipeline. Userscripts are customized TypeScript files that apply transformation logic to rows of data on a per-schema and per-table basis. Userscripts are intended to address unique business or data transformation needs. They perform operations that cannot be handled by the source change data capture (CDC) stream, such as filtering out specific tables, rows, or columns; routing data from a single source table to multiple target tables; transforming column values or adding computed columns; and implementing custom error handling. These tranformations occur in-flight, between the source and target databases. To have MOLT Replicator apply a userscript, include the flag with any . The flag accepts a path to a TypeScript filename.Monitoring
Metrics
MOLT Replicator metrics are not enabled by default. Enable Replicator metrics by specifying the flag with a port (orhost:port) when you start Replicator. This exposes Replicator metrics at http://{host}:{port}/_/varz. For example, the following flag exposes metrics on port 30005:
Logging
By default, MOLT Replicator writes two streams of logs: operational logs tostdout (including warning, info, trace, and some errors) and final errors to stderr.
Redirect both streams to ensure all logs are captured for troubleshooting:
Docker usage
Local connection strings
When testing locally, specify the host as follows:-
For macOS, use
host.docker.internal. For example: -
For Linux and Windows, use
172.17.0.1. For example:
Common uses
Forward replication (after initial load)
In a migration that utilizes , run thereplicator command after . Run the replicator command with the required flags, as shown below:
- PostgreSQL
- MySQL
- Oracle
To start replication after an initial data load with MOLT Fetch, use the Specify the source and target database connections. For connection string formats, refer to Source connection strings and Target connection strings:Specify the target schema on CockroachDB with in fully-qualified To replicate from the correct position, specify the appropriate checkpoint value.Use to specify the slot , which automatically tracks the LSN (Log Sequence Number) checkpoint:Use to specify the staging database in fully-qualified At minimum, the For detailed walkthroughs of migrations that use Specify the target database connection (the database you originally migrated from) with . For connection string formats, refer to Target connection strings:Specify the CockroachDB connection string with . For details, refer to .Specify the staging database name with in fully-qualified Specify a webhook endpoint address for the changefeed to send changes to with . For example:Specify TLS certificate and private key file paths for secure webhook connections with and :At minimum, the After starting
pglogical command:database.schema format:database.schema format. Use to create it automatically on first run:replicator command should include the following flags:replicator in this way, refer to these common migration approaches:Failback replication
A migration that utilizes replicates data from the CockroachDB cluster back to the source database. In this case, MOLT Replicator acts as an HTTPS for a CockroachDB changefeed.Use thestart command for failback:database.schema format. This should be the same staging database created during Forward replication with initial load:replicator command should include the following flags:replicator, create a CockroachDB changefeed to send changes to MOLT Replicator. For a detailed example, refer to .When , you specify the target database and schema in the webhook URL path. For PostgreSQL targets, use the fully-qualified format
/database/schema (/migration_db/migration_schema). For MySQL targets, use the database name (/migration_db). For Oracle targets, use the uppercase schema name (/MIGRATION_SCHEMA).Explicitly set a default 10s value in the CREATE CHANGEFEED statement. This value ensures that the webhook can report failures in inconsistent networking situations and make crash loops more visible.Resume after an interruption
Whether you’re using Replicator to perform forward replication or failback replication, an unexpected issue may cause replication to stop.- PostgreSQL
- MySQL
- Oracle
To resume replication, run the
pglogical command using the same --stagingSchema value from your initial replication command.Be sure to specify the same --slotName value that you used during your initial replication command. The replication slot on the source PostgreSQL database automatically tracks the LSN (Log Sequence Number) checkpoint, so replication will resume from where it left off.http://localhost:30005/_/varz to track replication progress.
Known limitations
- Replication modes require connection to the primary instance (PostgreSQL primary, MySQL primary/master, or Oracle primary). MOLT cannot obtain replication checkpoints or transaction metadata from replicas.
- Running DDL on the source or target while replication is in progress can cause replication failures.
TRUNCATEoperations on the source are not captured. OnlyINSERT,UPDATE,UPSERT, andDELETEevents are replicated.- Changes to virtual columns are not replicated automatically. To migrate these columns, you must define them explicitly with .
- MySQL replication is supported only with GTID-based configurations. Binlog-based features that do not use GTID are not supported.
- Replication will not work for tables or column names exceeding 30 characters. This is a limitation of Oracle LogMiner.
- The following data types are not supported for replication:
- User-defined types (UDTs)
- Nested tables
VARRAYLONGBLOB/CLOBcolumns (over 4000 characters)
- If your Oracle workload executes
UPDATEstatements that modify only LOB columns, theseUPDATEstatements are not supported by Oracle LogMiner and will not be replicated. - If you are using Oracle 11 and execute
UPDATEstatements onXMLTYPEor LOB columns, those changes are not supported by Oracle LogMiner and will be excluded from ongoing replication. - If you are migrating LOB columns from Oracle 12c, use AWS DMS Binary Reader instead of LogMiner. Oracle LogMiner does not support LOB replication in 12c.

