All Products
Search
Document Center

Realtime Compute for Apache Flink:Data synchronization templates

Last Updated:Mar 26, 2026

Writing Flink SQL for MySQL-to-Hologres synchronization from scratch requires understanding CDAS and CTAS statement syntax, handling schema changes manually, and managing server IDs for CDC connectors. Data synchronization templates generate this SQL automatically — you select the source and destination catalogs, choose a synchronization method, and the template produces a ready-to-deploy Flink SQL file that covers full data, incremental data, and schema changes.

Synchronization methods

Two methods are available. Choose based on how your source data is structured:

MethodUse whenSQL generated
Multi-database multi-table synchronizationSynchronizing one or more tables from one or more databases to a single destination databaseCREATE DATABASE AS (CDAS)
Sharded-data mergingMerging multiple sharded tables with a similar schema into one destination tableCREATE TABLE AS (CTAS)

Both methods use Flink Change Data Capture (CDC) connectors to automatically synchronize full data, incremental data, and schema changes (such as added columns) from each source table to the destination.

Limitations

Data synchronization templates only support MySQL as the source and Hologres as the destination.

Prerequisites

Before you begin, ensure that you have:

Table creation behavior: Realtime Compute for Apache Flink automatically creates the destination table in Hologres. If the table already exists, data is synchronized based on the destination database and table you select during plan creation.

Data type changes: Hologres does not allow changing column data types. If a source field's data type differs from the existing Hologres table, the write fails. Change the column data type and re-synchronize.

Default naming: The template creates the destination database and table with the same names as the source catalog, synchronized to the public schema by default. To change the database name, table name, or schema, use SQL statements instead. See CREATE TABLE AS (CTAS) and CREATE DATABASE AS (CDAS).

Synchronize data using a template

  1. Log on to the Realtime Compute for Apache Flink console.

  2. Find the workspace and click Console in the Actions column.

  3. In the left navigation menu, click Development > ETL. Click the image icon and select New Draft with Template.

  4. In the New Draft dialog box, click the Flink CDC tab. Select the Data Synchronization from MySQL to Hologres card, and click Next.

  5. Configure the source and sink: Click Next.

    CategoryParameterDescription
    SourceMySQL CatalogSelect an existing MySQL catalog. If none exists, click Create Catalog. See Manage MySQL catalogs.
    SourceMySQL server-idEnter a unique ID for each MySQL database client. Valid values: 5400–6400. You can also specify a range (for example, 5400-5408). If parallel reading is enabled in incremental reading mode, specify a range to assign a unique server ID to each parallel thread.
    Important

    Do not use the same server-id for different deployments or services that access the database.

    SinkHologres CatalogSelect an existing Hologres catalog. If none exists, click Create Catalog. See Manage Hologres Catalog.

    选择源和目标

  6. Create a plan. Follow the steps for your chosen synchronization method:

    • Multi-database multi-table synchronization

      1. On the To Single Database tab, select the source database and table. 数据模板中文

      2. Click Save Plan. The plan appears in the plan list. 计划列表

        Note

        The template creates a database and table in the destination catalog with the same names as the source. Both are synchronized to the public schema by default. To customize the database name, table name, or schema, use SQL statements instead. See CREATE TABLE AS (CTAS) and CREATE DATABASE AS (CDAS).

      3. Click Next.

      4. Review the generated SQL. You can modify Name, Location, or Engine Version based on your requirements. 多库多表SQL预览

    • Sharded-data merging

      1. On the To Multiple Databases tab, select the source databases and tables, or enter the destination database and table names. 分库分表 We recommend that you use regular expressions to specify the source databases and source tables.

      2. Click Save Plan. The plan appears in the plan list. 计划列表 You can create multiple plans — for multi-database multi-table synchronization and sharded-data merging — within a single draft. 多个执行计划

      3. Click Next.

      4. Review the generated SQL. You can modify Name, Location, or Engine Version based on your requirements. 分库分表SQL预览

  7. Click Create. You are redirected to the SQL Editor page. From here, the workflow is the same as for a standard deployment. See Job development map and Start a job deployment.

What's next