All Products
Search
Document Center

PolarDB:Synchronize data from a self-managed MySQL database hosted on ECS to a PolarDB for MySQL cluster

Last Updated:Mar 28, 2026

Use Data Transmission Service (DTS) to continuously synchronize data from a self-managed MySQL database on Elastic Compute Service (ECS) to a PolarDB for MySQL cluster — including both historical data and ongoing changes.

Prerequisites

Before you begin, ensure that you have:

Source database account permissions

The database account must have the following permissions on the objects to be synchronized:

  • SELECT on objects to be synchronized

  • REPLICATION CLIENT

  • REPLICATION SLAVE

  • SHOW VIEW

Destination cluster account permissions

The database account on the PolarDB for MySQL cluster must have read and write permissions on all objects to be synchronized.

Billing

Synchronization typeFee
Schema synchronization and full data synchronizationFree of charge
Incremental data synchronizationCharged. See Billing overview.

Supported SQL operations

TypeOperations
DMLINSERT, UPDATE, DELETE, REPLACE
DDLALTER TABLE, ALTER VIEW, CREATE FUNCTION, CREATE INDEX, CREATE PROCEDURE, CREATE TABLE, CREATE VIEW, DROP INDEX, DROP TABLE, RENAME TABLE, TRUNCATE TABLE
Important

RENAME TABLE operations can cause data inconsistency. If you select a specific table as the synchronization object and rename it during synchronization, changes to that table stop being replicated to the destination cluster. To prevent this, select the parent database (not the individual table) as the synchronization object, and make sure the database is included in the synchronization objects both before and after the rename.

Supported synchronization topologies

  • One-way one-to-one synchronization

  • One-way one-to-many synchronization

  • One-way cascade synchronization

  • One-way many-to-one synchronization

For details, see Synchronization topologies.

Limitations

Trigger incompatibility

If you select a database as the object to synchronize and the database contains a trigger that updates a table, data inconsistency may occur. See Configure a data synchronization task for a source database that contains a trigger for a workaround.

Primary key requirement

Source tables must have PRIMARY KEY or UNIQUE constraints, and all fields must be unique. Without this, the destination cluster may contain duplicate records.

Usage notes

  • DTS reads from the source and writes to the destination during initial full data synchronization, increasing the load on both instances. Run the synchronization task during off-peak hours, when CPU utilization on both instances is below 30%.

  • Do not use gh-ost or pt-online-schema-change for DDL operations during synchronization. These tools can cause the task to fail.

  • Concurrent INSERT operations during initial full data synchronization create table fragmentation in the destination cluster. After synchronization completes, the destination tablespace will be larger than the source.

  • Adding DTS server CIDR blocks to your whitelist or security group rules introduces security risks. Take preventive measures such as restricting exposed ports, auditing whitelist entries regularly, and considering private connectivity options like Express Connect, VPN Gateway, or Smart Access Gateway (SAG) instead of public internet access.

Set up the synchronization task

Step 1: Purchase a DTS instance

Purchase a DTS instance. On the purchase page, set:

  • Source Instance: MySQL

  • Destination Instance: PolarDB

  • Synchronization Topology: One-way Synchronization

Step 2: Configure source and destination databases

  1. Log on to the DTS console.

    If you are redirected to the Data Management (DMS) console, click the old icon in the image to return to the previous version of the DTS console.
  2. In the left-side navigation pane, click Data Synchronization.

  3. At the top of the Synchronization Tasks page, select the region where the destination instance resides.

  4. Find the synchronization instance and click Configure Task in the Actions column.

  5. Configure the source and destination databases using the following parameters.

    Source database

    ParameterDescription
    Task NameA descriptive name for the task. Does not need to be unique.
    Instance TypeSelect User-Created Database in ECS Instance.
    Instance RegionThe source region you selected on the purchase page. Read-only.
    ECS Instance IDThe ID of the ECS instance that hosts the self-managed MySQL database.
    Database TypeSet to MySQL. Read-only.
    Port NumberThe port number of the self-managed MySQL database.
    Database AccountThe account with the required permissions listed in the Prerequisites.
    Database PasswordThe password for the database account.

    Destination database

    ParameterDescription
    Instance TypeSet to PolarDB Instance. Read-only.
    Instance RegionThe destination region you selected on the purchase page. Read-only.
    PolarDB Instance IDThe ID of the destination PolarDB for MySQL cluster.
    Database AccountThe account with read and write permissions on the objects to be synchronized.
    Database PasswordThe password for the database account.

Step 3: Configure the whitelist

Click Set Whitelist and Next in the lower-right corner.

  • If the source or destination database is an Alibaba Cloud database instance, such as an ApsaraDB RDS for MySQL or ApsaraDB for MongoDB instance, DTS automatically adds the CIDR blocks of DTS servers to the IP address whitelist of the instance.

  • If the source or destination database is a self-managed database hosted on an ECS instance, DTS automatically adds the CIDR blocks of DTS servers to the security group rules of the ECS instance. If the database is hosted across multiple ECS instances, manually add the DTS CIDR blocks to the security group rules of each instance.

  • If the source or destination database is a self-managed database deployed in a data center or provided by a third-party cloud service provider, you must manually add the CIDR blocks of DTS servers to the IP address whitelist of the database.

For more information, see Add the CIDR blocks of DTS servers.

Step 4: Select objects and configure conflict handling

Configure the following settings, then click Next.

SettingDescription
Processing mode for existing target tablesPre-check and Intercept (default): DTS checks whether the destination cluster has tables with the same names as the source. The task fails precheck if conflicts are found. Use the object name mapping feature to resolve naming conflicts without deleting destination tables.<br><br>Ignore: Skips the name conflict check. During initial synchronization, DTS skips records that share primary keys with existing destination records. During incremental synchronization, DTS does write those records. If schemas differ between source and destination, the task may fail or synchronize only partial data.
Objects to synchronizeSelect tables or databases from the Available section and click 向右小箭头 to move them to the Selected section. Selecting a database synchronizes all schema changes within that database to the destination cluster.
Rename databases and tablesUse object name mapping to rename objects in the destination cluster.
Source table DMS_ ONLINE_ Do you want to copy the temporary table to the target database during DDLIf you use Data Management (DMS) to run online DDL operations on the source database, choose whether to synchronize the temporary tables generated by those operations.<br><br>Yes: Synchronizes temporary table data. Large online DDL operations may increase synchronization latency.<br><br>No: Skips temporary tables and synchronizes only the original DDL. Destination tables may be temporarily locked.
Retry time for failed connectionsDefault is 720 minutes (12 hours). If DTS reconnects within this window, the task resumes automatically. If the retry window expires without reconnection, the task fails. DTS charges apply while retries are in progress.
Warning

Selecting Ignore does not guarantee data consistency. During initial synchronization, DTS skips records whose primary keys already exist in the destination. During incremental synchronization, DTS writes those same records. If source and destination schemas differ, the task may fail or produce incomplete data.

Step 5: Select initial synchronization types

Select the synchronization types to include.

Advanced settings

Selecting both Initial Schema Synchronization and Initial Full Data Synchronization causes DTS to replicate existing schemas and data before switching to incremental synchronization.

Step 6: Run the precheck and start synchronization

  1. Click Precheck in the lower-right corner.

  2. If the precheck fails, click the 提示 icon next to each failed item to view details. Fix the issues and run the precheck again. If you do not need to fix an issue, ignore the failed item and start a new precheck.

  3. After the Precheck Passed message appears, close the Precheck dialog box. The synchronization task starts automatically.

  4. On the Synchronization Tasks page, monitor the task status. Wait until initial synchronization is complete and the task enters the Synchronizing state.

    View the status of a data synchronization task

What's next