All Products
Search
Document Center

PolarDB:Synchronize data from an ApsaraDB RDS for MySQL instance to a PolarDB for MySQL cluster

Last Updated:Jul 01, 2026

Data Transmission Service (DTS) synchronizes data from an ApsaraDB RDS for MySQL instance to a PolarDB for MySQL cluster, supporting schema synchronization, full data synchronization, and incremental data synchronization.

Supported source databases

DTS supports the following MySQL database types as synchronization sources. This document uses an ApsaraDB RDS for MySQL instance as an example. The same procedure applies to other source types.

  • ApsaraDB RDS for MySQL instance

  • Self-managed database hosted on Elastic Compute Service (ECS)

  • Self-managed database connected over Express Connect, VPN Gateway, or Smart Access Gateway

  • Self-managed database connected over Database Gateway

  • Self-managed database connected over Cloud Enterprise Network (CEN)

Prerequisites

Before you begin, make sure that:

  • An ApsaraDB RDS for MySQL instance is created. For more information, see Create an ApsaraDB RDS for MySQL instance.

  • A PolarDB for MySQL cluster is created. For more information, see Purchase an Enterprise Edition cluster and Purchase a subscription cluster.

  • The PolarDB for MySQL cluster has more available storage than the total data size in the ApsaraDB RDS for MySQL instance.

  • The source database account has the REPLICATION CLIENT, REPLICATION SLAVE, SHOW VIEW, and SELECT permissions.

  • The destination database account has read and write permissions on the destination database.

Binary log requirements

The source database must meet the following binary log requirements. For ApsaraDB RDS for MySQL, binary logging is enabled by default.

Parameter Required value Notes
binlog_row_image full Required for all source types. If not set to full, the precheck fails and the task cannot start. For ApsaraDB RDS for MySQL, see Modify instance parameters.
binlog_format row Required for self-managed MySQL databases only.
log_slave_updates ON Required for self-managed MySQL databases deployed in a dual-primary cluster only. Allows DTS to obtain all binary logs. For more information, see Create an account for a self-managed MySQL database and configure binary logging.
Binary log retention At least 7 days If DTS cannot obtain the required binary logs, the task may fail. In exceptional circumstances, data inconsistency or loss may occur. Otherwise, the Service Level Agreement (SLA) of DTS may not be guaranteed. For more information, see Manage binary log files.

Billing

Synchronization type Cost
Schema synchronization and full data synchronization Free of charge
Incremental data synchronization Charged. For more information, see Billing overview.

The billing method and instance class are configured in the final step of the task creation process. DTS supports both subscription and pay-as-you-go billing.

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 more information, see Synchronization topologies.

Supported SQL operations

Operation type SQL statement
DML INSERT, UPDATE, and DELETE
DDL ALTER TABLE, ALTER VIEW, CREATE FUNCTION, CREATE INDEX, CREATE PROCEDURE, CREATE TABLE, CREATE VIEW, DROP INDEX, DROP TABLE, RENAME TABLE, and TRUNCATE TABLE
Important

RENAME TABLE may cause data inconsistency between the source and destination databases. If a table is selected as the synchronization object and renamed during synchronization, the renamed table is not synchronized. To prevent this, select the database that contains the table as the synchronization object. Make sure that both the original and renamed databases are included in the synchronization objects.

Limits

Source database limits

  • Tables to synchronize must have PRIMARY KEY or UNIQUE constraints, and all fields must be unique. Otherwise, the destination database may contain duplicate data records.

  • When tables are selected as synchronization objects and need to be modified (such as renaming tables or columns), a single task supports up to 1,000 tables. To synchronize more than 1,000 tables, configure multiple tasks or synchronize the entire database.

Destination database limits

  • The database version of the destination must be the same as or later than that of the source database. Otherwise, compatibility issues may occur.

DDL and schema limits

  • Do not use pt-online-schema-change to perform online DDL operations on tables selected for synchronization. Otherwise, the task fails. Use DMS to perform online DDL operations instead. For more information, see Perform lock-free DDL operations.

  • If DDL statements fail in the destination database, the synchronization task continues. View the failed DDL statements in the task logs. For more information, see View task logs.

  • DTS cannot convert data from the DATETIME type to the VARCHAR type.

Performance and data limits

  • Schedule synchronization during off-peak hours. During initial full data synchronization, DTS uses read and write resources on both the source and destination databases, which may increase load on the database servers.

  • Full data synchronization causes fragmentation in destination tables through concurrent INSERT operations. After full data synchronization, the destination tablespace is larger than the source.

  • Throttling cannot be enabled for full data migration.

  • Writing data from other sources to the destination database during synchronization causes data inconsistency. For example, running online DDL statements through DMS while other sources write to the destination may cause data loss.

Foreign key behavior

  • During schema synchronization, DTS synchronizes foreign keys from the source to the destination database.

  • During full data synchronization and incremental data synchronization, DTS temporarily disables the constraint check and cascade operations on foreign keys at the session level. Performing cascade update and delete operations on the source database during synchronization may cause data inconsistency.

EncDB limit

  • If the source ApsaraDB RDS for MySQL instance has the EncDB feature enabled, full data synchronization cannot be performed.

Self-managed MySQL limits

The following limits apply only when the source is a self-managed MySQL database:

  • Primary/secondary switchover: Performing a primary/secondary switchover on the source database while the task is running causes the task to fail.

  • Synchronization latency: DTS calculates synchronization latency based on the timestamp of the latest synchronized data in the destination database and the current timestamp in the source database. If no DML operation is performed on the source database for a long time, the latency may be inaccurate. To update the latency, perform a DML operation on the source database. If an entire database is selected as the synchronization object, create a heartbeat table that is updated or receives data every second.

  • Binary log position: DTS executes CREATE DATABASE IF NOT EXISTS 'test' in the source database as scheduled to advance the binary log file position.

ApsaraDB RDS limit

  • An ApsaraDB RDS for MySQL instance that does not record transaction logs cannot be used as the source database. For example, a read-only ApsaraDB RDS for MySQL 5.6 instance cannot be used.

Create a synchronization task

  1. Go to the Data Synchronization Tasks page of the new DTS console.

    Alternatively, log on to the DMS console. In the top navigation bar, move the pointer over DTS and choose DTS (DTS) > Data Synchronization.
  2. On the right side of Data Synchronization Tasks, select the region in which the data synchronization instance resides.

    Note

    If you use the new DTS console, you must select the region in which the data synchronization instance resides in the top navigation bar.

  3. In the top navigation bar, select the region for the data synchronization task.

  4. Click Create Task and configure the source and destination databases as described in the following tables.

    Warning

    After configuring the source and destination databases, read the Limits displayed in the upper part of the page. Ignoring them may cause task failure or data inconsistency.

    Source database

    Parameter Description
    Task Name DTS automatically assigns a task name. Specify a descriptive name that makes the task easy to identify. A unique name is not required.
    Database Type Select MySQL.
    Connection Type Select Alibaba Cloud Instance.
    Instance Region Select the region of the source ApsaraDB RDS for MySQL instance.
    Cross-account Select No.
    RDS Instance ID Select the ID of the source ApsaraDB RDS for MySQL instance. The source and destination instances can be the same or different. DTS supports synchronization between two instances or within a single instance.
    Database Account Enter the database account of the source instance. The account must have the REPLICATION CLIENT, REPLICATION SLAVE, SHOW VIEW, and SELECT permissions.
    Database Password Enter the password of the database account.
    Connection Method Select Non-encrypted or SSL-encrypted. If SSL-encrypted is selected, enable SSL encryption for the ApsaraDB RDS for MySQL instance before configuring the task. For more information, see Configure the SSL encryption feature.

    Destination database

    Parameter Description
    Database Type Select PolarDB for MySQL.
    Connection Type Select Alibaba Cloud Instance.
    Instance Region Select the region of the destination PolarDB for MySQL cluster.
    PolarDB Cluster ID Select the ID of the destination PolarDB for MySQL cluster.
    Database Account Enter the database account of the destination cluster. The account must have read and write permissions on the destination database.
    Database Password Enter the password of the database account.
  5. Click Test Connectivity and Proceed. 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 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, and you must make sure that the ECS instance can access the database. If the database is deployed on multiple ECS instances, manually add the CIDR blocks of DTS servers to the security group rules of each ECS instance. If the source or destination database is a self-managed database in a data center or provided by a third-party cloud service provider, manually add the CIDR blocks of DTS servers to the whitelist of the database. For more information, see Add the CIDR blocks of DTS servers.

    Warning

    Adding DTS server CIDR blocks to the whitelist of the database, the instance, or ECS security group rules may introduce security risks. Before using DTS, take preventive measures such as strengthening credentials, limiting exposed ports, authenticating API calls, periodically reviewing whitelist and security group rules to remove unauthorized CIDR blocks, or connecting the database to DTS through Express Connect, VPN Gateway, or Smart Access Gateway.

  6. Configure synchronization objects and advanced settings.

    Basic settings

    Parameter Description
    Synchronization Types Incremental Data Synchronization is selected by default. Also select Schema Synchronization and Full Data Synchronization. After the precheck, DTS synchronizes the historical data of selected objects from the source database to the destination cluster as the basis for subsequent incremental synchronization.
    Processing Mode of Conflicting Tables Precheck and Report Errors: Checks whether the destination database contains tables with the same names as the source. If identical table names exist, the precheck returns an error and the task cannot start. If identical names exist but the destination tables cannot be deleted or renamed, use the object name mapping feature to rename the tables synchronized to the destination. For more information, see Map object names. Ignore Errors and Proceed: Skips the precheck for identical table names.
    Warning

    If this option is selected, data inconsistency may occur and your business may be exposed to potential risks: (1) If the source and destination databases have the same schema and a data record shares the same primary key or unique key value, during full data synchronization DTS skips the record (keeping the existing destination record), and during incremental data synchronization DTS overwrites the existing destination record. (2) If the source and destination databases have different schemas, data initialization may fail, only some columns may be synchronized, or the task may fail. Proceed with caution.

    Select Objects Select objects from the Source Objects section and move them to the Selected Objects section. Columns, tables, or databases can be selected. Selecting tables or columns does not synchronize other objects such as views, triggers, and stored procedures.
    Rename Databases and Tables To rename a single object, right-click it in the Selected Objects section. For more information, see Map the name of a single object. To rename multiple objects at once, click Batch Edit in the upper-right corner of the Selected Objects section. For more information, see Map multiple object names at a time.
    Filter data Specify WHERE conditions to filter data. For more information, see Set filter conditions.
    SQL operations to synchronize Right-click an object in the Selected Objects section to select the DML and DDL operations to synchronize. For more information, see Supported SQL operations.

    Advanced settings

    Parameter Description
    Monitoring and Alerting Configure alerting for the task. If the task fails or synchronization latency exceeds the threshold, alert contacts receive notifications. Select No to skip alerting, or Yes to configure the alert threshold and notification settings. For more information, see Configure monitoring and alerting when you create a DTS task.
    Capitalization of Object Names in Destination Instance Set the capitalization of database, table, and column names in the destination instance. The default is DTS default policy. For more information, see Specify the capitalization of object names in the destination instance.
    Copy the temporary table of the Online DDL tool that is generated in the source table to the destination database Specify whether to synchronize temporary tables generated by online DDL operations performed through DMS or the gh-ost tool. Do not use pt-online-schema-change; otherwise, the DTS task fails. Options: Yes -- synchronizes temporary table data (may extend task duration for large datasets). No, Adapt to DMS Online DDL -- synchronizes only the original DDL operations performed through DMS. Tables in the destination database may be locked. No, Adapt to gh-ost -- synchronizes only the original DDL operations performed through gh-ost. Uses default or custom regular expressions to filter shadow tables and unnecessary tables. Tables in the destination database may be locked.
    Retry Time for Failed Connection Set the retry duration for failed connections after the task starts. Valid values: 10 to 1440 minutes. Default: 720 minutes. Set this to a value greater than 30. If DTS reconnects within the specified duration, the task resumes. Otherwise, the task fails. If different retry durations are set for multiple tasks that share the same source or destination database, the shortest duration takes precedence. DTS charges for the instance during retries. Specify the retry duration based on your business requirements. Release the DTS instance at your earliest opportunity after the source and destination instances are released.
  7. Save the task settings and run the precheck.

    • To view the API parameters for this task, hover over Next: Save Task Settings and Precheck and click Preview OpenAPI parameters.

    • Click Next: Save Task Settings and Precheck.

    DTS performs a precheck before starting the task. The task can start only after it passes the precheck. - If the precheck fails, click View Details next to the failed item. Troubleshoot the issue and run the precheck again. - If a precheck item generates an alert that cannot be ignored, click View Details, troubleshoot the issue, and run the precheck again. - If a precheck item generates an alert that can be ignored, click Confirm Alert Details, then click Ignore in the dialog box, and click OK. Then click Precheck Again. Ignoring alerts may cause data inconsistency or introduce business risks.
  8. Wait until the success rate reaches 100%, then click Next: Purchase Instance.

  9. Configure the synchronization instance.

    Parameter Description
    Billing Method Subscription: Pay upfront for a fixed term. More cost-effective for long-term use, with lower prices for longer terms. Pay-as-you-go: Billed hourly with no commitment. Suitable for short-term use. Release the instance when no longer needed to stop charges.
    Resource Group Settings Select the resource group for the instance. Default: default resource group. For more information, see What is Resource Management?
    Instance Class Select a synchronization specification based on performance requirements. Synchronization speed varies by specification. For more information, see Instance classes of data synchronization instances.
    Subscription Duration Available only for the Subscription billing method. Options: 1 to 9 months, or 1, 2, 3, or 5 years.
  10. Read and select Data Transmission Service (Pay-as-you-go) Service Terms.

  11. Click Buy and Start to start the data synchronization task. Track the task progress in the task list.