All Products
Search
Document Center

Data Transmission Service:Synchronizing ApsaraDB RDS for MySQL instances across Alibaba Cloud accounts

Dernière mise à jour :Aug 27, 2026

DTS supports data synchronization between ApsaraDB RDS for MySQL instances across different Alibaba Cloud accounts. This topic describes how to create a data synchronization task where the source and destination instances are in different Alibaba Cloud accounts.

Prerequisites

  • You have created the source and destination ApsaraDB RDS for MySQL instances. For more information, see Create an ApsaraDB RDS for MySQL instance.

  • The destination ApsaraDB RDS for MySQL instance must have more available storage space than the amount of storage space used by the source instance.

Usage notes

  • During initial full data synchronization, DTS occupies read and write resources on both the source and destination databases, which may increase the database load. If the database has poor performance, low specifications, or heavy workload—such as slow SQL statements on the source database, tables without primary keys, or deadlocks on the destination database—the load may increase further and, in severe cases, the database service may become unavailable. Therefore, before you perform data synchronization, evaluate the performance of the source and destination databases. We recommend that you synchronize data during off-peak hours (for example, when the CPU load of the source and destination databases is below 30%).

  • If a table to be synchronized in the source database lacks a primary key or unique constraint, duplicate data may occur in the destination database.

  • During initial full data synchronization, concurrent INSERT operations cause fragmentation in the destination database's tables. After the synchronization is complete, the tablespace of the destination database is larger than that of the source database.

  • Cross-region synchronization across Alibaba Cloud accounts is supported. Currently, two-way synchronization across Alibaba Cloud accounts is supported only between ApsaraDB RDS for MySQL instances.

  • You can obtain database instance information from the source and destination Alibaba Cloud accounts only after completing the preparations.

    Important

    We recommend deleting the RAM role created during preparation once the cross-account data synchronization is complete.

  • Source database binary logs (binlogs):

    • By default, binary logging is enabled for an ApsaraDB RDS for MariaDB instance. You must ensure that the binlog_row_image parameter is set to full. Otherwise, the precheck reports an error and prevents the data synchronization task from starting. For more information about how to set parameters, see Set instance parameters.

    • The DTS Service Level Agreement (SLA) does not cover issues caused by an insufficient binary log retention period. For incremental data synchronization tasks, DTS requires that the local binary logs of the source database be retained for at least 24 hours. For tasks that include both full and incremental data synchronization, the binary logs must be retained for at least 7 days. You can change the retention period to 24 hours or more after full data synchronization is complete. If DTS cannot obtain the binary logs, the task may fail. In extreme cases, data inconsistency or loss may occur.

  • Resolvers defined by comment syntax do not support synchronous use.

  • If your source database uses online DDL operations in temporary table mode—including but not limited to multi-table merge scenarios—or adds function-based indexes to unique key columns, data loss or task failure may occur in the destination database.

  • If you write columns with names that differ only in case to the same table in the destination MySQL database, unexpected results may occur because MySQL column names are case-insensitive.

  • After data synchronization completes (the instance's Status is Completed), you should use the ANALYZE TABLE <table_name> command to confirm that all data is written to the target table. For example, after the HA failover mechanism is triggered in the target MySQL database, data might be written only to memory, which can cause data loss.

  • In this topic, all references to an Alibaba Cloud account are to the main account.

  • If you are performing data synchronization where only the source database is in a different Alibaba Cloud account (the Replicate Data Across Alibaba Cloud Accounts option for the source database is set to Yes), the destination database instance belongs to the Alibaba Cloud account that is used to create the DTS task.

  • If your ApsaraDB RDS for MySQL instance has Always-Encrypted enabled, full data synchronization is not supported.

    Note

    ApsaraDB RDS for MySQL instances with Transparent Data Encryption (TDE) enabled support schema synchronization, full data synchronization, and incremental data synchronization.

  • During schema synchronization and full data synchronization, do not perform DDL operations that change the database or table schema. Otherwise, the data synchronization instance fails.

  • Data generated by changes that do not write to binary logs—such as data restored from physical backups or created by cascade operations—is not synchronized to the destination database.

    Note

    If this occurs, remove the affected database or table from the synchronization objects. Then add it back. You can do this only if your business allows it. For more information, see Modify synchronization objects.

  • DTS periodically runs the CREATE DATABASE IF NOT EXISTS `test` command in the source database to advance the binary log offset.

  • ApsaraDB RDS for MySQL instances that do not record transaction logs, such as read-only instances of ApsaraDB RDS for MySQL 5.6, cannot be used as a source database.

  • If your data includes four-byte characters—such as rare Chinese characters or emojis—the destination database and table must use the utf8mb4 charset.

    Note

    If you use DTS to synchronize table schemas, set the character_set_server parameter at the instance level in the destination database to utf8mb4.

  • To synchronize accounts from the source database, meet the prerequisites and review related considerations. For more information, see Migrate database accounts.

  • If a task fails, DTS support staff will attempt to restore it within eight hours. During restoration, they may restart the task or adjust its parameters.

    Note

    Only DTS task parameters are modified—not database parameters. Parameters that may be adjusted include those listed in Modify instance parameters.

  • Ensure neither the source nor destination database contains invisible hidden columns in the columns to synchronize. Otherwise, the DTS task may fail or data may be lost.

    Note

    You can use the ALTER TABLE <table_name> ALTER COLUMN <column_name> SET VISIBLE; statement to make an invisible column visible. For more information, see Invisible Columns.

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 about the supported synchronization topologies and their usage, see Synchronization topologies.

Supported SQL operations

Operation type

SQL statement

DML

INSERT, UPDATE, DELETE, and REPLACE

DDL

  • ALTER TABLE and ALTER VIEW

  • CREATE FUNCTION, CREATE INDEX, CREATE PROCEDURE, CREATE TABLE, and CREATE VIEW

  • DROP INDEX and DROP TABLE

  • RENAME TABLE

    Important

    RENAME TABLE operations may cause data inconsistency between the source and destination databases. For example, if you select a table as the object to be synchronized and rename the table during data synchronization, the data of this table is not synchronized to the destination database. To prevent this situation, you can select the database to which this table belongs as the object to be synchronized when you configure the data synchronization task. Make sure that the databases to which the table belongs before and after the RENAME TABLE operation are added to the objects to be synchronized.

  • TRUNCATE TABLE

Database account permissions

Instance

Required permissions

References

Source ApsaraDB RDS for MySQL instance

Read-only permissions on the objects to be synchronized.

Create accounts and databases and Modify the permissions of a standard account on an ApsaraDB RDS for MySQL instance.

Destination ApsaraDB RDS for MySQL instance

Read and write permissions on the destination database.

Note

If you also synchronize database accounts, the accounts on both the source and destination instances require additional permissions. For more information, see Migrate database accounts.

Limits

RENAME TABLE operations can cause data inconsistency between the source instance and the destination database. For example, if the synchronization scope includes only Table A and the source instance renames Table A to Table B during data synchronization, Table B is not synchronized to the destination database. To work around this issue, select the entire database containing both Table A and Table B as the synchronization object when you configure the data synchronization task.

Billing

Synchronization type

Fee

Full data synchronization

Free of charge

Incremental data synchronization

Charged. See Billing overview.

Procedure

Note

This topic shows how to configure a synchronization instance when the source and destination databases belong to different Alibaba Cloud accounts. For more information, see How to configure RAM authorization for a cross-Alibaba Cloud account task.

  1. Configure RAM authorization. For details, see Scenario 3: The source and destination databases belong to different Alibaba Cloud accounts.

  2. Log on to the DTS console with the Alibaba Cloud account used to create the DTS task and go to the synchronization task list page in the destination region. You can use one of the following methods.

    DTS console

    1. Log on to the DTS console.DTS console

    2. In the left-side navigation pane, click Data Synchronization.

    3. In the upper-left corner, select the region where the synchronization task resides.

    DMS console

    Note

    The actual steps may vary based on the mode and layout of the DMS console. See Simple mode and Customize the layout and style of the DMS console.

    1. Log on to the DMS console.DMS console

    2. In the top navigation bar, move the pointer over Data + AI and choose DTS (DTS) > Data Synchronization.

    3. From the drop-down list next to Data Synchronization Tasks, select the region where the instance resides.

  3. Click Create Task to open the task configuration page.

  4. Configure the source and destination databases.

    Warning

    After selecting the source and destination instances, review the Limits at the top of the page to ensure the task can be created and run successfully.

    Category

    Parameter

    Description

    N/A

    Task Name

    DTS automatically generates a task name. We recommend that you specify a descriptive name for easy identification. The name does not need to be unique.

    Source Database

    Select Existing Connection

    • To use a database instance that is added to the system (newly created or saved), select the database instance from the drop-down list. The database information is automatically configured.

      Note

      In the DMS console, this configuration item is named Select a DMS database instance..

    • If you have not added the database instance to the system, or you do not need to use an instance that is already added, manually configure the following database information.

    Database Type

    Select MySQL.

    Connection Type

    Select Alibaba Cloud Instance.

    Instance Region

    Select the region where the source RDS for MySQL instance is located.

    Note

    The source and destination RDS instances can be in different regions.

    Replicate Data Across Alibaba Cloud Accounts

    Select Yes.

    Alibaba Cloud Account

    Enter the ID of the Alibaba Cloud account to which the source database belongs.

    Note

    For information about how to obtain the account ID, see Obtain the ID of the Alibaba Cloud account for the source database.

    RAM Role Name

    Enter the name of the RAM role created in the Alibaba Cloud account for the source database, for example, ram-for-dts. For details on creating a RAM role, see Create a RAM role.

    Important

    Do not enter the default role for DTS, which is AliyunDTSDefaultRole.

    RDS Instance ID

    Select the ID of the source RDS for MySQL instance.

    Note

    If an alert appears when you select the RDS instance ID, modify the settings as prompted. For common alerts, see Common errors.

    Database Account

    Enter the database account of the source RDS for MySQL instance.

    Database Password

    Enter the password for the database account.

    Encryption

    Select Non-encrypted or SSL-encrypted based on your needs. This example uses Non-encrypted.

    Note

    If you select SSL-encrypted, you must first enable SSL encryption for the RDS instance. For more information, see Configure SSL encryption.

    Destination Database

    Select Existing Connection

    • To use a database instance that is added to the system (newly created or saved), select the database instance from the drop-down list. The database information is automatically configured.

      Note

      In the DMS console, this configuration item is named Select a DMS database instance..

    • If you have not added the database instance to the system, or you do not need to use an instance that is already added, manually configure the following database information.

    Database Type

    Select MySQL.

    Connection Type

    Select Alibaba Cloud Instance.

    Instance Region

    Select the region where the destination RDS for MySQL instance is located.

    Note

    The source and destination RDS for MySQL instances can be in different regions.

    Replicate Data Across Alibaba Cloud Accounts

    Select Yes.

    Alibaba Cloud Account

    Enter the ID of the Alibaba Cloud account to which the destination database belongs.

    Note

    For information about how to obtain the account ID, see Obtain the ID of the Alibaba Cloud account for the destination database.

    RAM Role Name

    Enter the name of the RAM role created in the Alibaba Cloud account for the destination database, for example, ram-for-dts. For details on creating a RAM role, see Create a RAM role.

    Important

    Do not enter the default role for DTS, which is AliyunDTSDefaultRole.

    RDS Instance ID

    Select the ID of the destination RDS for MySQL instance.

    Note

    If an alert appears when you select the RDS instance ID, modify the settings as prompted. For common alerts, see Common errors.

    Database Account

    Enter the database account of the destination RDS for MySQL instance.

    Database Password

    Enter the password for the database account.

    Encryption

    Select Non-encrypted or SSL-encrypted based on your needs. This example uses Non-encrypted.

    Note

    If you select SSL-encrypted, you must first enable SSL encryption for the RDS instance. For more information, see Configure SSL encryption.

  5. After you have completed the configuration, click Test Connectivity and Proceed at the bottom of the page.

    Note
    • Ensure that the IP address CIDR blocks of DTS servers are added to the security settings of the source and destination databases to allow access from DTS servers. This can be done automatically or manually. For more information, see Add the IP address CIDR blocks of DTS servers to a whitelist.

    • If the source or destination database is a self-managed database (where the Access Method is not Alibaba Cloud Instance), you must also click Test Connectivity in the CIDR Blocks of DTS Servers dialog box.

  6. Configure task objects.

    1. On the Configure Objects page, configure the objects to synchronize.

      Parameter

      Description

      Synchronization Types

      Incremental Data Synchronization is selected by default. We recommend that you also select Schema Synchronization and Full Data Synchronization. After the precheck is complete, DTS performs a full data initialization of the selected objects in the destination instance. This data serves as the baseline for subsequent incremental data synchronization.

      Method to Migrate Triggers in Source Database

      Select a method to synchronize triggers based on your business requirements. If the objects to be synchronized do not involve triggers, you do not need to configure this parameter. For more information, see Configure how to synchronize or migrate triggers.

      Note

      You can configure this parameter only if you select Schema Synchronization for Synchronization Types.

      Enable Migration Assessment

      Specifies whether to assess if the schemas of the source and destination databases meet requirements. The assessment checks items such as index length, stored procedures, and table dependencies. You can choose Yes or No based on your business needs. If you choose Yes, the precheck may take longer. You can view the assessment results during the precheck phase. The assessment results do not affect the precheck outcome.

      Note
      • You can configure this parameter only if you select Schema Synchronization for Synchronization Types.

      • If you select Yes, the precheck may take longer. You can view the Assessment Result during the precheck phase. The assessment results do not affect the precheck outcome.

      Synchronization Topology

      In this example, One-way Synchronization is selected.

      Processing Mode of Conflicting Tables

      • Precheck and Report Errors: DTS checks for tables with the same name in the destination database. If a conflict exists, DTS reports an error during the precheck and does not start the task.

        Note

        If it is not practical to delete or rename the conflicting table, you can map the table to a different name. For more information, see Map object names.

      • Ignore Errors and Proceed: Skips the check for tables with the same name in the destination database.

        Warning

        If you select Ignore Errors and Proceed, data inconsistency may occur. For example:

        • If the table schemas are consistent, destination records with the same primary or unique key as source records are overwritten.

        • If the table schemas are inconsistent, the task may fail or only partially synchronize data. Proceed with caution.

      Whether to migrate Event

      Select whether to migrate source database events. If you select Yes, additional steps are required. Synchronize or migrate events.

      Capitalization of Object Names in Destination Instance

      You can configure the case sensitivity policy for database, table, and column object names that are synchronized to the destination instance. By default, the DTS default policy is selected. You can also choose to use the default policies of the source and destination databases. For more information, see Case sensitivity policy for destination object names.

      Source Objects

      In the Source Objects box, click an object to synchronize, and then click 向右 to move it to the Selected Objects box.

      Note

      You can select databases, tables, and columns as synchronization objects. If you select tables or columns, other objects such as views, triggers, and stored procedures are not synchronized to the destination database.

      Selected Objects

      Note
      • To select SQL operations to synchronize at the database or table level, right-click an object in the Selected Objects box and select the desired SQL operations in the dialog box. For a list of supported operations, see Supported SQL operations.

      • To filter data by using WHERE clauses, right-click a table in the Selected Objects box and specify the filter conditions in the dialog box. For details, see Set filter conditions.

    2. Click Next: Advanced Settings to configure advanced parameters.

      Parameter

      Description

      Dedicated Cluster for Task Scheduling

      By default, DTS schedules tasks on a shared cluster, and you do not need to select a cluster. For more stable performance, you can purchase a dedicated cluster to run DTS sync tasks. For more information, see What is a DTS dedicated cluster?.

      Copy the temporary table of the Online DDL tool that is generated in the source table to the destination database.

      If you use Data Management (DMS) or gh-ost to perform online DDL changes in the source database, you can choose whether to synchronize the data of temporary tables generated by the online DDL changes.

      Important
      • DTS tasks do not support using tools such as pt-online-schema-change to perform online DDL changes. Using such tools will cause the DTS task to fail.

      • The processing methods for each stage are as follows: The Schema Synchronization and Full Data Synchronization stages do not allow DDL operations that change the database or table schema. Therefore, these stages are not controlled by the Online DDL policy.

        • Schema Synchronization: This stage is not controlled by the Online DDL policy. Related temporary tables are created.

        • Full Data Synchronization: This stage is not controlled by the Online DDL policy. Temporary tables are not included in the full synchronization objects. All tables whose names match the regular expression (^_(.+)_(?:gho|new)$ or ^_(.+)_(?:ghc|del|old)$) are filtered out.

        • Incremental Data Synchronization: This stage is controlled by the Online DDL policy.

          • Yes: Synchronizes data changes in temporary tables (for example, _table-name_gho) that are generated by online DDL operations.

          • No, Adapt to DMS Online DDL and No, Adapt to gh-ost: Filter out data changes in temporary tables (for example, _table-name_gho) that are generated by tools such as gh-ost based on regular expression rules.

      • Yes: Synchronizes temporary table data generated by online DDL changes.

        Note

        If the data of temporary tables generated by online DDL changes is too large, it may cause synchronization latency.

      • No, Adapt to DMS Online DDL: Does not synchronize data from temporary tables generated by online DDL operations. It synchronizes only the original DDL statements executed using Data Management (DMS) in the source database.

        Note

        This option causes locked tables in the destination database.

      • No, Adapt to gh-ost: Does not synchronize data from temporary tables generated by online DDL changes. It supports custom filtering rules. DTS filters out data changes in temporary tables (for example, _table-name_gho) generated by tools such as gh-ost based on regular expression rules. You can modify the default regular expressions used to match shadow tables and useless tables as needed:

        • Shadow table: ^_(.+)_(?:gho|new)$

        • Useless table: ^_(.+)_(?:ghc|del|old)$

        Note

        This option causes locked tables in the destination database.

      Whether to Migrate Accounts

      Select whether to synchronize account information from the source database based on your business requirements. If you select Yes, you must also select the accounts to synchronize and confirm their permissions.

      Retry Time for Failed Connections

      After a sync task starts, if the connection to the source or destination database fails, DTS reports an error and immediately begins to retry the connection. The default retry duration is 720 minutes. You can also specify a custom retry duration from 10 to 1,440 minutes. We recommend that you set the duration to 30 minutes or more. If DTS successfully reconnects to the database within the specified duration, the sync task automatically resumes. Otherwise, the task fails.

      Note
      • If you have multiple DTS instances (for example, Instance A and Instance B) that share the same source or destination, and you set the network retry time to 30 minutes for Instance A and 60 minutes for Instance B, the shorter duration of 30 minutes is used for both.

      • Because DTS charges for task runtime during the connection retry period, we recommend that you customize the retry duration based on your business needs or release the DTS instance as soon as possible after the source and destination database instances are released.

      Retry Time for Other Issues

      After the sync task starts, if other non-connectivity issues occur with the source or destination database (such as DDL or DML execution exceptions), DTS reports an error and immediately starts continuous retry operations. The default retry duration is 10 minutes. You can also customize the retry duration within the range of 1 to 1,440 minutes. We recommend that you set it to 10 minutes or more. If the relevant operations are successful within the set retry duration, the sync task automatically resumes. Otherwise, the task fails.

      Important

      The value for Retry Time for Other Issues must be less than that for Retry Time for Failed Connections.

      Enable Throttling for Full Data Synchronization

      During the full synchronization stage, DTS consumes read and write resources from the source and destination databases, which can increase the database load. To reduce the load on the source and destination databases, you can set a rate limit for the full synchronization task by configuring the Queries per second (QPS) to the source database, RPS of Full Data Migration, and Data migration speed for full migration (MB/s) parameters.

      Note
      • This configuration item is available only when Synchronization Types is set to Full Data Synchronization.

      • You can also adjust the full synchronization rate after the sync instance is running.

      Enable Throttling for Incremental Data Synchronization

      You can also set a rate limit for the incremental synchronization task. To relieve pressure on the destination database, set the RPS of Incremental Data Synchronization and Data synchronization speed for incremental synchronization (MB/s).

      Environment Tag

      You can select an environment tag to identify the instance based on your business requirements. This example does not require a tag.

      Configure ETL

      Choose whether to enable the extract, transform, and load (ETL) feature. For more information, see What is ETL? Valid values:

      Whether to delete SQL operations on heartbeat tables of forward and reverse tasks

      Choose whether to write heartbeat SQL information to the source database when the DTS instance is running.

      • Yes: Heartbeat SQL information is not written to the source database. This may cause the DTS instance to report a delay.

      • No: Writes heartbeat SQL information to the source database. This may interfere with features such as physical backup and cloning of the source database.

      Monitoring and Alerting

      Specify whether to configure alerts. If the synchronization fails or the latency exceeds the specified threshold, a notification is sent to an alert contact.

    3. Click Next: Data Validation to configure a data validation task.

      If you want to use the data validation feature, see Configure data validation for configuration instructions.

  7. Save the task and run a precheck.

    • To view the API parameters for configuring this instance, hover over the Next: Save Task Settings and Precheck button and click Preview OpenAPI parameters in the bubble.

    • If you have finished viewing the API parameters, click Next: Save Task Settings and Precheck at the bottom of the page.

    Note
    • Before the synchronization job starts, DTS runs a precheck. The job can start only after all precheck items pass.

    • If the precheck fails, click View Details for the failed item. Fix the issue as prompted, and then run the precheck again.

    • If the precheck returns a warning:

      • If a check item fails and cannot be ignored, click View Details next to the item. Follow the instructions to fix the issue, and then run the precheck again.

      • For check items that can be ignored, you can click Confirm Alert Details, Ignore, OK, and Precheck Again in sequence to skip the warning and rerun the precheck. If you choose to shield the warning item, it may cause issues such as data inconsistency and pose risks to your business.

  8. Purchase the instance.

    1. When the Success Rate is 100%, click Next: Purchase Instance.

    2. On the Purchase page, select the billing method and link specification for the data synchronization instance. The following table describes these parameters in detail.

      Category

      Parameter

      Description

      New Instance Class

      Billing Method

      • Subscription: You pay when you create the instance. This is suitable for long-term needs and is more cost-effective than pay-as-you-go. The longer the subscription duration, the higher the discount.

      • Pay-as-you-go: You are charged on an hourly basis. This is suitable for short-term needs. You can release the instance immediately after use to save costs.

      Resource Group Configuration

      The resource group to which the instance belongs. The default is default resource group. For more information, see What is Resource Management?.

      Link Specification

      DTS provides sync specifications with different performance levels. The sync link specification affects the synchronization rate. You can choose a specification based on your business scenario. For more information, see Data synchronization link specifications.

      Subscription Duration

      In subscription mode, select the duration and quantity for the subscription instance. You can choose a monthly subscription from 1 to 9 months, or a yearly subscription of 1, 2, 3, or 5 years.

      Note

      This option is only available when the billing method is Subscription.

    3. After you complete the configuration, read and select Data Transmission Service (Pay-as-you-go) Service Terms.

    4. Click Buy and Start. In the OK dialog box, click OK.

      You can view the task progress on the Data Synchronization page.