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
Copy file name to clipboardExpand all lines: docs/content/connectors/mysql-cdc.md
+47-4Lines changed: 47 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -218,7 +218,7 @@ Connector Options
218
218
<td>optional</td>
219
219
<td style="word-wrap: break-word;">initial</td>
220
220
<td>String</td>
221
-
<td>Optional startup mode for MySQL CDC consumer, valid enumerations are "initial","earliest-offset", "latest-offset", "specific-offset" and "timestamp".
221
+
<td>Optional startup mode for MySQL CDC consumer, valid enumerations are "initial", "earliest-offset", "latest-offset", "specific-offset" and "timestamp".
222
222
Please see <a href="#startup-reading-position">Startup Reading Position</a> section for more detailed information.</td>
223
223
</tr>
224
224
<tr>
@@ -233,14 +233,28 @@ Connector Options
233
233
<td>optional</td>
234
234
<td style="word-wrap: break-word;">(none)</td>
235
235
<td>Long</td>
236
-
<td>Optional GTID set used in case of "specific-offset" startup mode</td>
236
+
<td>Optional binlog file position used in case of "specific-offset" startup mode</td>
237
237
</tr>
238
238
<tr>
239
239
<td>scan.startup.specific-offset.gtid-set</td>
240
240
<td>optional</td>
241
241
<td style="word-wrap: break-word;">(none)</td>
242
-
<td>Long</td>
243
-
<td>Optional binlog file position used in case of "specific-offset" startup mode</td>
242
+
<td>String</td>
243
+
<td>Optional GTID set used in case of "specific-offset" startup mode</td>
244
+
</tr>
245
+
<tr>
246
+
<td>scan.startup.specific-offset.skip-events</td>
247
+
<td>optional</td>
248
+
<td style="word-wrap: break-word;">(none)</td>
249
+
<td>String</td>
250
+
<td>Optional number of events to skip after the specific starting offset</td>
251
+
</tr>
252
+
<tr>
253
+
<td>scan.startup.specific-offset.skip-rows</td>
254
+
<td>optional</td>
255
+
<td style="word-wrap: break-word;">(none)</td>
256
+
<td>String</td>
257
+
<td>Optional number of rows to skip after the specific starting offset</td>
244
258
</tr>
245
259
<tr>
246
260
<td>server-time-zone</td>
@@ -554,6 +568,35 @@ the end of the binlog which means only have the changes since the connector was
554
568
specified with binlog filename and position, or a GTID set if GTID is enabled on server.
555
569
-`timestamp`: Skip snapshot phase and start reading binlog events from a specific timestamp.
556
570
571
+
For example in DataStream API:
572
+
```java
573
+
MySQLSource.builder()
574
+
.startupOptions(StartupOptions.earliest()) // Start from earliest offset
575
+
.startupOptions(StartupOptions.latest()) // Start from latest offset
576
+
.startupOptions(StartupOptions.specificOffset("mysql-bin.000003", 4L) // Start from binlog file and offset
577
+
.startupOptions(StartupOptions.specificOffset("24DA167-0C0C-11E8-8442-00059A3C7B00:1-19")) // Start from GTID set
578
+
.startupOptions(StartupOptions.timestamp(1667232000000L) // Start from timestamp
579
+
...
580
+
.build()
581
+
```
582
+
583
+
and with SQL:
584
+
585
+
```SQL
586
+
CREATETABLE mysql_source (...) WITH (
587
+
'connector'='mysql-cdc',
588
+
'scan.startup.mode'='earliest-offset', --Start from earliest offset
589
+
'scan.startup.mode'='latest-offset', --Start from latest offset
590
+
'scan.startup.mode'='specific-offset', --Start from specific offset
591
+
'scan.startup.mode'='timestamp', --Start from timestamp
592
+
'scan.startup.specific-offset.file'='mysql-bin.000003', --Binlog filename under specific offset startup mode
593
+
'scan.startup.specific-offset.pos'='4', --Binlog position under specific offset mode
594
+
'scan.startup.specific-offset.gtid-set'='24DA167-0C0C-11E8-8442-00059A3C7B00:1-19', --GTID set under specific offset startup mode
595
+
'scan.startup.timestamp-millis'='1667232000000'--Timestamp under timestamp startup mode
596
+
...
597
+
)
598
+
```
599
+
557
600
**Note:**MySQL source will print the current binlog position into logs with INFO level on checkpoint, with the prefix
558
601
"Binlog offset on checkpoint {checkpoint-id}".It could be useful if you want to restart the job from a specific checkpointed position.
0 commit comments