Flink CDC connectors can be used to synchronize data and table schema changes in real time. You can use a data synchronization template to quickly generate Flink SQL deployment code for data synchronization. This topic describes how to use a multi-database multi-table synchronization template or a sharded-data merging template to synchronize data.
Background information
Synchronization method | Description |
---|---|
Multi-database and multi-table synchronization | If you want to synchronize one or more business data tables from one or more databases to another database in real time, you can use the multi-database multi-table synchronization template. Flink CDC connectors can automatically synchronize the full and incremental data of an entire database. Flink CDC connectors can also synchronize the schema changes of each source table, such as added columns, to the destination table in real time. The multi-database multi-table synchronization template converts your parameters into the CREATE DATABASE AS statement. For more information about the CREATE DATABASE AS statement, see CREATE DATABASE AS statement. |
Sharded-data merging | If your business data is scattered in different databases or business tables, you need to merge multiple tables in a sharded database to synchronize data from the tables that have a similar schema to one destination table. Flink CDC connectors can automatically synchronize the full and incremental data of all table shards in the sharded database from source databases. The tables include the new tables that meet regular expressions. Flink CDC connectors can also synchronize the table schema changes of each source table, such as added columns, to the destination table in real time. The sharded-data merging template converts your parameters into the CREATE TABLE AS statement. For more information about the CREATE TABLE AS statement, see CREATE TABLE AS statement. |
Limits
Flink CDC connectors can synchronize data only from MySQL to Hologres.
Precautions
- You do not need to manually create a table in Hologres.
Fully managed Flink automatically creates a table in Hologres. However, if the required table already exists in Hologres, fully managed Flink synchronizes data based on the destination database that you select in the creation plan and table information.
- Hologres does not allow you to change the data types of columns.
If the data type of the current field is different from the data type of the Hologres table, the data fails to be written. In this case, you must modify the data type of the column and synchronize the data again.
For more information about Hologres result tables, see Create a Hologres result table.
Procedure
- Log on to the Realtime Compute for Apache Flink console.
- On the Fully Managed Flink tab, find the workspace that you want to manage and click Console in the Actions column.
- In the left-side navigation pane, click SQL Editor. In the upper-left corner of the SQL Editor page, click New.
- In the New Draft dialog box, click the Flink CDC tab.
- Double-click the Data Synchronization from MySQL to Hologres card, or click the card and click Next in the lower-right corner of the dialog box.
- Configure the data synchronization information.
- Click Create. After you click Create, you are redirected to the SQL Editor page. The subsequent operations are the same as the operations that are required to develop a common deployment. For more information about the parameter configurations and subsequent operations, see Develop a draft and Start a deployment.