You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following message shows the appropriate values for the `--backfillFromSCN` and `--scn` replication flags to use when [starting Replicator](#start-replicator):
6
+
7
+
{% include_cached copy-clipboard.html %}
8
+
~~~
9
+
replication-only mode should include the following replicator flags: --backfillFromSCN 26685444 --scn 26685786
10
+
~~~
11
+
</section>
12
+
{% endif %}
13
+
3
14
A `starting fetch` message indicates that the task has started:
The following message shows the appropriate values for the `--backfillFromSCN` and `--scn` replication flags to use when [starting Replicator](#start-replicator):
89
-
90
-
{% include_cached copy-clipboard.html %}
91
-
~~~
92
-
replication-only mode should include the following replicator flags: --backfillFromSCN 26685444 --scn 26685786
Connect to the primary PostgreSQL instance, **not** a read replica. Read replicas cannot create or manage logical replication slots. Verify that you are connected to the primary server by running `SELECT pg_is_in_recovery();` and getting a `false` result.
133
+
Connect to the primary instance (PostgreSQL primary, MySQL primary/master, or Oracle primary), **not** a replica. Replicas cannot provide the necessary replication checkpoints and transaction metadata required for ongoing replication.
Enable [global transaction identifiers (GTID)](https://dev.mysql.com/doc/refman/8.0/en/replication-options-gtids.html) and configure binary logging. Set `binlog-row-metadata` or `binlog-row-image` to `full` to provide complete metadata for replication.
198
149
150
+
Configure binlog retention to ensure GTIDs remain available throughout the migration:
151
+
152
+
- MySQL 8.0.1+: Set `binlog_expire_logs_seconds` (default: 2592000 = 30 days) based on your migration timeline.
153
+
- MySQL < 8.0: Set `expire_logs_days`, or manually manage retention by setting `max_binlog_size` and using `PURGE BINARY LOGS BEFORE NOW() - INTERVAL 1 HOUR` (adjusting the interval as needed). Force binlog rotation with `FLUSH BINARY LOGS` if needed.
154
+
- Managed services: Refer to provider-specific configuration for [Amazon RDS](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/mysql-stored-proc-configuring.html) or [Google Cloud SQL](https://cloud.google.com/sql/docs/mysql/flags#mysql-b).
155
+
156
+
{% comment %}
199
157
{{site.data.alerts.callout_info}}
200
-
GTID replication sends all database changes to Replicator. To limit replication to specific tables or schemas, use the `--table-filter` and `--schema-filter` flags in the `replicator` command.
158
+
GTID replication sends all database changes to Replicator. To limit replication to specific tables or schemas, use a userscript.
| MySQL 5.6 |`--gtid-mode=on`<br>`--enforce-gtid-consistency=on`<br>`--server-id={unique_id}`<br>`--log-bin=mysql-binlog`<br>`--binlog-format=row`<br>`--binlog-row-image=full`<br>`--log-slave-updates=ON`|
206
165
| MySQL 5.7 |`--gtid-mode=on`<br>`--enforce-gtid-consistency=on`<br>`--binlog-row-image=full`<br>`--server-id={unique_id}`<br>`--log-bin=log-bin`|
207
166
| MySQL 8.0+ |`--gtid-mode=on`<br>`--enforce-gtid-consistency=on`<br>`--binlog-row-metadata=full`|
If you plan to use [initial data load](#start-fetch) followed by [replication](#start-replicator), obtain the correct SCNs **before** starting the initial data load to ensure no active transactions are missed. Run the following queries on the PDB in the order shown:
383
-
384
-
{% include_cached copy-clipboard.html %}
385
-
~~~sql
386
-
-- Query the current SCN from Oracle
387
-
SELECT CURRENT_SCN FROM V$DATABASE;
388
-
389
-
-- Query the starting SCN of the earliest active transaction
390
-
SELECTMIN(t.START_SCNB) FROM V$TRANSACTION t;
391
-
~~~
392
-
393
-
Use the results as follows:
394
-
395
-
-`--scn`: Use the result from the first query (current SCN)
396
-
-`--backfillFromSCN`: Use the result from the second query (earliest active transaction SCN). If the second query returns no results, use the result from the first query instead.
397
-
398
304
Add the redo log files to LogMiner, using the redo log file paths you queried:
Copy file name to clipboardExpand all lines: src/current/_includes/molt/molt-connection-strings.md
+6-2Lines changed: 6 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,12 @@ Define the connection strings for the [source](#source-connection-string) and [t
4
4
5
5
The `--source` flag specifies the connection string for the source database:
6
6
7
+
{% if page.name != "migrate-bulk-load.md" %}
8
+
{{site.data.alerts.callout_info}}
9
+
The source connection **must** point to the primary instance (PostgreSQL primary, MySQL primary/master, or Oracle primary). Replicas cannot provide the necessary replication checkpoints and transaction metadata required for ongoing replication.
- Replication modes require write access to the PostgreSQL primary instance. MOLT cannot create replication slots or run replication against a read replica.
22
-
</section>
20
+
- 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.
- MySQL replication is supported only with [GTID](https://dev.mysql.com/doc/refman/8.0/en/replication-gtids.html)-based configurations. Binlog-based features that do not use GTID are not supported.
Copy file name to clipboardExpand all lines: src/current/_includes/molt/molt-setup.md
+27-1Lines changed: 27 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,6 +37,32 @@
37
37
38
38
{% include molt/migration-create-sql-user.md %}
39
39
40
+
{% if page.name != "migrate-bulk-load.md" %}
41
+
### Configure GC TTL
42
+
43
+
Before starting the [initial data load](#start-fetch), configure the [garbage collection (GC) TTL]({% link {{ site.current_cloud_version }}/configure-replication-zones.md %}#gc-ttlseconds) on the source CockroachDB cluster to ensure that historical data remains available when replication begins. The GC TTL must be long enough to cover the full duration of the data load.
44
+
45
+
Increase the GC TTL before starting the data load. For example, to set the GC TTL to 24 hours:
46
+
47
+
{% include_cached copy-clipboard.html %}
48
+
~~~sql
49
+
ALTERDATABASE defaultdb CONFIGURE ZONE USING gc.ttlseconds=86400;
50
+
~~~
51
+
52
+
{{site.data.alerts.callout_info}}
53
+
The GC TTL duration must be higher than your expected time for the initial data load.
54
+
{{site.data.alerts.end}}
55
+
56
+
Once replication has started successfully (which automatically protects its own data range), you can restore the GC TTL to its original value. For example, to restore to 5 minutes:
57
+
58
+
{% include_cached copy-clipboard.html %}
59
+
~~~sql
60
+
ALTERDATABASE defaultdb CONFIGURE ZONE USING gc.ttlseconds=300;
61
+
~~~
62
+
63
+
For details, refer to [Protect Changefeed Data from Garbage Collection]({% link {{ site.current_cloud_version }}/protect-changefeed-data.md %}).
64
+
{% endif %}
65
+
40
66
## Configure Fetch
41
67
42
68
When you run `molt fetch`, you can configure the following options for data load:
@@ -46,7 +72,7 @@ When you run `molt fetch`, you can configure the following options for data load
46
72
-[Table handling mode](#table-handling-mode): Determine how existing target tables are initialized before load.
47
73
-[Schema and table filtering](#schema-and-table-filtering): Specify schema and table names to migrate.
48
74
-[Data load mode](#data-load-mode): Choose between `IMPORT INTO` and `COPY FROM`.
49
-
-[Fetch metrics](#fetch-metrics): Configure metrics collection during the load.
75
+
-[Fetch metrics](#fetch-metrics): Configure metrics collection during initial data load.
This error occurs when the source database does not support logical replication.
90
+
This error occurs when logical replication is not supported.
91
91
92
-
**Resolution:** Verify that the source database supports logical replication by checking the `wal_level` parameter on PostgreSQL:
92
+
**Resolution:** If you are connected to a replica, connect to the primary instance instead. Replicas cannot create or manage logical replication slots or publications.
93
+
94
+
Verify that the source database supports logical replication by checking the `wal_level` parameter on PostgreSQL:
93
95
94
96
{% include_cached copy-clipboard.html %}
95
97
~~~ sql
@@ -154,23 +156,35 @@ run SELECT pg_create_logical_replication_slot('molt_slot', 'pgoutput'); in sourc
For PostgreSQL, the replication slot on the source database tracks progress automatically. Clearing the memo table is only necessary if the replication slot was destroyed and you need to restart replication from a specific LSN.
166
+
167
+
**Resolution:** Clear the `_replicator.memo` table:
If Replicator repeatedly restarts binlog syncing, this indicates an invalid or purged GTID.
187
+
If Replicator repeatedly restarts binlog syncing or starts replication from an unexpectedly old location, this indicates an invalid or purged GTID. When an invalid GTID is provided, the binlog syncer will fall back to the first valid GTID.
174
188
175
189
**Resolution:** Verify the GTID set is valid and **not** purged:
176
190
@@ -209,6 +223,16 @@ If the GTID is purged or invalid, follow these steps:
Use the `Executed_Gtid_Set` value for the `--defaultGTIDSet` flag.
235
+
212
236
##### Invalid GTID format
213
237
214
238
Invalid GTIDs can occur when GTIDs are purged due to insufficient binlog retention, when connecting to a replica instead of the primary host, or when passing a GTID that has valid format but doesn't exist in the binlog history.
@@ -276,7 +300,7 @@ WARNING: warning during tryCommit: ERROR: duplicate key value violates unique co
276
300
ERROR: maximum number of retries (10) exceeded
277
301
~~~
278
302
279
-
**Resolution:** Check target database constraints and connection stability. MOLT Replicator will log warnings for each retry attempt and surface a final errorafter exhausting all retry attempts, then restart the apply loop to continue processing.
303
+
**Resolution:** Check target database constraints and connection stability. MOLT Replicator will log warnings for each retry attempt. If you see warnings but no final error, the apply succeeded after retrying. If all retry attempts are exhausted, Replicator will surface a final error and restart the apply loop to continue processing.
0 commit comments