All Products
Search
Document Center

Data Transmission Service:Synchronize data from RDS for MySQL to ApsaraMQ for RocketMQ

Last Updated:Jul 17, 2026

You can use Data Transmission Service (DTS) to synchronize data from a MySQL database, such as a self-managed MySQL database or an ApsaraDB RDS for MySQL instance, to an ApsaraMQ for RocketMQ instance. This topic covers how to synchronize data from an ApsaraDB RDS for MySQL instance.

Prerequisites

  • You must have a destination ApsaraMQ for RocketMQ instance (non-serverless). For more information, see Manage instances or Manage instances.

    Note

    See Data Synchronization Overview for the supported versions of the source and destination databases.

  • You must have a topic in the destination ApsaraMQ for RocketMQ instance to receive synchronized data. For more information, see Manage topics or Manage topics.

    Important

    For 4.x series instances, the Message Type of the topic must be set to Partitionally Ordered Message.

    For 5.x series instances, the Message Type of the topic must be set to Ordered Message.

Limitations

Type

Description

Source database

  • Synchronization objects:

    • The tables to synchronize must have a primary key or a unique constraint, and the fields must be unique. Otherwise, duplicate data may appear in the destination database.

    • If you synchronize at the table level and need to edit mappings (such as column name mapping), each synchronization task supports up to 1,000 tables. If you exceed this limit, the task fails with an error. To fix this, split the tables across multiple tasks or configure a full-database synchronization task.

  • Binary logs:

    • ApsaraDB RDS for MySQL enables binary logging by default. Ensure that the binlog_row_image parameter is set to full. Otherwise, the precheck fails and the synchronization task cannot start. For instructions, see Configure instance parameters.

      Important
      • If your source instance is a self-managed MySQL database, enable binary logging and set binlog_format to row and binlog_row_image to full.

      • If your self-managed MySQL database is a dual-primary cluster (where both nodes act as primary and secondary), enable the log_slave_updates parameter so DTS can capture all binary log events. For instructions, see Create an account and configure binary logging for a self-managed MySQL database.

    • The local binary logs for an ApsaraDB RDS for MySQL instance must be retained for at least three days (seven days is recommended). For a self-managed MySQL database, retain local binary logs for at least seven days. Otherwise, DTS may fail to retrieve binary logs, causing the task to fail. In extreme cases, this may cause data inconsistency or data loss. Issues caused by binary log retention periods shorter than DTS requires are not covered under the DTS SLA.

      Note

      To configure the retention period for local binary logs on an ApsaraDB RDS for MySQL instance, see Automatically delete local logs.

  • During the schema synchronization and full data synchronization phases, do not perform DDL operations that change the database or table structure. Otherwise, the data synchronization task will fail.

    Note

    During the full data synchronization phase, DTS queries the source database. This query generates metadata locks, which may block DDL operations on the source database.

  • 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.

  • If your source database is MySQL 8.0.23 or later and contains invisible hidden columns, DTS may not read those columns. This may cause data loss.

    Note

    Run the ALTER TABLE <table_name> ALTER COLUMN <column_name> SET VISIBLE; command to make the hidden column visible. For more information, see Invisible Columns.

Other limitations

  • A serverless ApsaraMQ for RocketMQ instance cannot be used as the destination.

  • You can synchronize data only to specific topics in the destination ApsaraMQ for RocketMQ instance.

    • For ApsaraMQ for RocketMQ 4.x: The Message Type of the destination topic must be Partitionally Ordered Message.

      If the target Message Queue for RocketMQ instance is in a different Instance Region from the source database, DTS accesses the target Message Queue for RocketMQ instance by using its public endpoint, and public network traffic fees are incurred. You must ensure that public access is enabled for the target Message Queue for RocketMQ instance.

      Note
      • You can check the status of public access on the Basic Information tab of the Instance Details page in the ApsaraMQ for RocketMQ console.

      • For more information about the internet traffic fees for the destination ApsaraMQ for RocketMQ instance, see Internet traffic pricing details.

    • For ApsaraMQ for RocketMQ 5.x: The Message Type of the destination topic must be Ordered Message.

  • The destination ApsaraMQ for RocketMQ instance supports a maximum message body size of 4 MB.

  • If the specifications of the destination ApsaraMQ for RocketMQ instance change (for example, when you upgrade or downgrade the instance), the delivery order of the DTS instance may differ from the order before the change. Messages are subsequently delivered based on the new order.

  • During full data synchronization, DTS consumes read and write resources from both the source and destination databases, which may increase their load. We recommend evaluating the performance of both databases and synchronizing data during off-peak hours (for example, when the CPU utilization of both databases is below 30%).

  • During full data synchronization, concurrent INSERT operations cause table fragmentation in the destination database. After full data synchronization is complete, the destination tables will occupy more storage space than the source tables.

  • During data synchronization, do not use tools such as pt-online-schema-change to perform online DDL operations on the synchronization objects in the source database. Otherwise, the task will fail.

  • During data synchronization, if sources other than DTS write data to the destination database, data inconsistency may occur between the source and destination databases.

  • If the EncDB feature is enabled for an ApsaraDB RDS for MySQL instance, full data synchronization is not supported.

    Note

    An ApsaraDB RDS for MySQL instance with transparent data encryption (TDE) enabled supports full data synchronization and incremental data synchronization.

  • 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.

Special cases

  • For a self-managed MySQL source database:

    • If a primary/secondary switchover occurs in the source database during synchronization, the task fails.

    • DTS calculates latency by comparing the timestamp of the last synchronized record with the current time. If no DML operations run for a long time in the source database, latency reporting may become inaccurate. If latency appears too high, run a DML operation in the source database to update the latency.

      Note

      If you select a full database for synchronization, create a heartbeat table. Update or write to this table every second.

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

    • If your source database is Amazon Aurora MySQL or another clustered MySQL instance, ensure the domain name or IP address used in the task configuration—and its DNS resolution—always points to a read/write (RW) node. Otherwise, synchronization may fail.

  • For an ApsaraDB RDS for MySQL source database:

    • Read-only instances—such as ApsaraDB RDS for MySQL 5.6 read-only instances—that do not record transaction logs cannot serve as source databases.

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

Billing

Synchronization type

Configuration fee

full data synchronization

Free of charge.

incremental data synchronization

Fees apply. For details, see billing overview.

SQL operations that can be synchronized

Operation type SQL statements
DML INSERT, UPDATE, DELETE
DDL CREATE TABLE, ALTER TABLE, DROP TABLE, RENAME TABLE, TRUNCATE TABLE; CREATE VIEW, ALTER VIEW, DROP VIEW; CREATE PROCEDURE, ALTER PROCEDURE, DROP PROCEDURE; CREATE FUNCTION, DROP FUNCTION, CREATE TRIGGER, DROP TRIGGER; CREATE INDEX, DROP INDEX
DTS does not synchronize foreign keys from the source to the destination. Cascade and delete operations on the source are not replicated.

Database account permissions

Database

Permissions

Actions

Source ApsaraDB RDS for MySQL

Read permissions on objects to synchronize.

Create an account and Modify account permissions.

Note

If you create and grant permissions for your source database account outside the ApsaraDB RDS for MySQL console, ensure that the account has the REPLICATION CLIENT, REPLICATION SLAVE, SHOW VIEW, and SELECT permissions.

Procedure

  1. Go to the data synchronization task list page in the destination region. You can do this in one of two ways.

    DTS console

    1. Log on to the DTS console.

    2. In the navigation pane on the left, click Data Synchronization.

    3. In the upper-left corner of the page, select the region where the synchronization instance is located.

    DMS console

    Note

    The actual steps may vary depending on the mode and layout of the DMS console. For more information, see Simple mode console and Customize DMS console layout and style.

    1. Log on to the DMS console.

    2. In the top menu bar, choose Data + AI > DTS (DTS) > Data Synchronization.

    3. To the right of Data Synchronization Tasks, select the region of the synchronization instance.

  2. Click Create Task to navigate to the task configuration page.

  3. Configure the source and destination databases.

    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

    • Select the registered database instance with DTS from the drop-down list. The database information below is automatically configured.

      Note

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

    • If you have not registered the database instance or do not need to use a registered instance, manually configure the database information below.

    Database Type

    Select MySQL.

    Access Method

    Select Alibaba Cloud Instance.

    Instance Region

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

    Replicate Data Across Alibaba Cloud Accounts

    For this example, select No, as the database instance belongs to the current Alibaba Cloud account.

    RDS Instance ID

    Select the ID of the source RDS for MySQL instance.

    Database Account

    Enter the database account for the source RDS for MySQL instance. See Database account permissions for permission requirements.

    Database Password

    Enter the password for the specified database account.

    Encryption

    Select Non-encrypted or SSL-encrypted as needed. If you set this to SSL-encrypted, you must enable SSL encryption for the RDS for MySQL instance beforehand. For more information, see Use a cloud certificate to quickly enable SSL link encryption.

    Destination Database

    Select Existing Connection

    • Select the registered database instance with DTS from the drop-down list. The database information below is automatically configured.

      Note

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

    • If you have not registered the database instance or do not need to use a registered instance, manually configure the database information below.

    Database Type

    Select RocketMQ.

    Access Method

    Select Alibaba Cloud Instance.

    Instance Region

    Select the region where the destination Message Queue for RocketMQ instance is located.

    RocketMQ version

    Select the version of the destination Message Queue for RocketMQ instance.

    Instance ID

    Select the ID of the destination Message Queue for RocketMQ instance.

    Database Account

    Enter the database account and password for the destination Message Queue for RocketMQ instance.

    Note
    • These parameters are required only when RocketMQ version is set to 5.x.

    • You can obtain the credentials on the Intelligent Authentication tab of the RAM page in the Message Queue for RocketMQ console.

    Database Password

    Topic

    From the drop-down list, select a topic to receive data.

    Topic That Stores DDL Information

    From the drop-down list, select a topic to store DDL information.

    Note

    If you do not select a topic, the DDL information is stored in the topic selected for the Topic parameter by default.

  4. After completing the configuration, click Test Connectivity and Proceed at the bottom of the page.

    Note
    • Ensure that you add the CIDR blocks of the DTS servers (either automatically or manually) to the security settings of both the source and destination databases to allow access. For more information, see Add the IP address whitelist of DTS servers.

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

  5. Configure the task objects.

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

      Parameter

      Description

      Synchronization Types

      By default, Incremental Data Synchronization is selected, which supports only Full Data Synchronization. Schema Synchronization is not supported. After the precheck is complete, DTS initializes the synchronization objects in the destination cluster with data from the source instance. This initial data serves as the baseline for subsequent incremental synchronization.

      Note

      When the destination database is a Message Queue for RocketMQ instance, Schema Synchronization is not supported.

      Processing Mode of Conflicting Tables

      • Precheck and Report Errors: Checks for tables with the same names in the destination database. If any tables with the same names are found, an error is reported during the precheck and the data synchronization task does not start. Otherwise, the precheck is successful.

        Note

        If you cannot delete or rename the table with the same name in the destination database, you can map it to a different name in the destination. For more information, see Object name mapping.

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

        Warning

        Selecting Ignore Errors and Proceed may cause data inconsistency and put your business at risk. For example:

        • If the table schemas are consistent and a record in the destination database has the same primary key or unique key value as a record in the source database:

          • During full data synchronization, DTS retains the destination record and skips the source record.

          • During incremental synchronization, DTS overwrites the destination record with the source record.

        • If the table schemas are inconsistent, data initialization may fail. This can result in only partial data synchronization or a complete synchronization failure. Use with caution.

      Format of the data delivered to RocketMQ.

      Select the storage format for writing data to the destination topic based on your requirements. For more information, see Data storage formats in message queues.

      Synchronize all fields

      For UPDATE operations, specify whether to synchronize the pre-image of only the updated fields or the entire row to the old field in the destination topic. A pre-image is the data record before an UPDATE operation is performed.

      Note

      This parameter is available only when Format of the data delivered to RocketMQ. is set to Canal JSON.

      • Yes: Synchronizes the pre-image of the entire row containing the updated fields.

      • No (Default): Synchronizes only the pre-image of the updated fields.

      Rules of the ordered messages delivered to RocketMQ.

      Select the message ordering rule for writing data to the destination topic. For more information, see Message ordering rules for Message Queue for RocketMQ.

      Name of DTS producer group

      You can specify a custom name for the producer group (ProducerGroup) that sends messages to the destination topic.

      Note

      The default value is dts-producer-group.

      Limits of RocketMQ messaging transactions per second (TPS)

      You can set a limit on the messaging transactions per second (TPS) for writing data to the destination topic. For more information about messaging TPS, see Calculation specifications.

      Important
      • The value must be less than or equal to the maximum TPS of the Message Queue for RocketMQ instance. For more information, see Instance specifications.

      • While the synchronization task is running, the actual messaging TPS of the Message Queue for RocketMQ instance may fluctuate slightly around the specified value.

      Whether to filter large size of records.

      Specify whether to filter out messages larger than 4 MB before writing them to the destination topic.

      Important

      If you select No, the synchronization task fails if it attempts to write a message larger than 4 MB to the destination topic.

      Capitalization of Object Names in Destination Instance

      Configure the case-sensitivity policy for database, table, and column names in the destination instance. By default, the DTS default policy is selected. You can also choose to use the default policy of the source or destination database. For more information, see Case policy for destination object names.

      Source Objects

      In the Source Objects box, click the objects, and then click 向右 to move them to the Selected Objects box.

      Note

      You can select databases or tables as synchronization objects.

      Selected Objects

      In this example, no additional configuration is needed. You can use the mapping feature to set the topic name, filter conditions, SQL operations to synchronize, and partition key for the data written to the destination Message Queue for RocketMQ instance. For more information, see Mapping information.

    2. Click Next: Advanced Settings.

      Parameter

      Description

      Dedicated Cluster for Task Scheduling

      By default, DTS uses a shared cluster for tasks, so you do not need to make a selection. For greater task stability, you can purchase a dedicated cluster to run the DTS synchronization task. For more information, see What is a DTS dedicated cluster?.

      Retry Time for Failed Connections

      If the connection to the source or destination database fails after the synchronization task starts, DTS reports an error and immediately begins to retry the connection. The default retry duration is 720 minutes. You can customize the retry time to a value from 10 to 1,440 minutes. We recommend a duration of 30 minutes or more. If the connection is restored within this period, the task resumes automatically. Otherwise, the task fails.

      Note
      • If multiple DTS instances (e.g., Instance A and B) share a source or destination, DTS uses the shortest configured retry duration (e.g., 30 minutes for A, 60 for B, so 30 minutes is used) for all instances.

      • DTS charges for task runtime during connection retries. Set a custom duration based on your business needs, or release the DTS instance promptly after you release the source/destination instances.

      Retry Time for Other Issues

      If a non-connection issue (e.g., a DDL or DML execution error) occurs, DTS reports an error and immediately retries the operation. The default retry duration is 10 minutes. You can also customize the retry time to a value from 1 to 1,440 minutes. We recommend a duration of 10 minutes or more. If the related operations succeed within the set retry time, the synchronization task automatically resumes. Otherwise, the task fails.

      Important

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

      Enable Throttling for Full Data Synchronization

      During full data synchronization, DTS consumes read and write resources from the source and destination databases, which can increase their load. To mitigate pressure on the destination database, you can limit the migration rate by setting Queries per second (QPS) to the source database, RPS of Full Data Migration, and Data migration speed for full migration (MB/s).

      Note

      Enable Throttling for Incremental Data Synchronization

      You can also limit the incremental synchronization rate to reduce pressure on the destination database by setting RPS of Incremental Data Synchronization and Data synchronization speed for incremental synchronization (MB/s).

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

      Choose whether DTS writes heartbeat SQL information to the source database while the instance is running.

      • Yes: Does not write heartbeat SQL information to the source database. The DTS instance may display latency.

      • No: Writes heartbeat SQL information to the source database. This may interfere with source database operations like physical backups and cloning.

      Environment Tag

      You can select an environment tag to identify the instance. In this example, no tag is needed.

      Configure ETL

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

      Monitoring and Alerting

      Choose whether to set up alerts. If the synchronization fails or the latency exceeds the specified threshold, DTS sends a notification to the alert contacts.

  6. Save the task and perform a precheck.

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

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

    Note
    • Before a synchronization task starts, DTS performs a precheck. You can start the task only if the precheck passes.

    • If the precheck fails, click View Details next to the failed item, fix the issue as prompted, and then rerun the precheck.

    • If the precheck generates warnings:

      • For non-ignorable warning, click View Details next to the item, fix the issue as prompted, and run the precheck again.

      • For ignorable warnings, you can bypass them by clicking Confirm Alert Details, then Ignore, and then OK. Finally, click Precheck Again to skip the warning and run the precheck again. Ignoring precheck warnings may lead to data inconsistencies and other business risks. Proceed with caution.

  7. Purchase the instance.

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

    2. On the Purchase page, select the billing method and link specifications for the data synchronization instance. For more information, see the following table.

      Category

      Parameter

      Description

      New Instance Class

      Billing Method

      • Subscription: You pay upfront for a specific duration. This is cost-effective for long-term, continuous tasks.

      • Pay-as-you-go: You are billed hourly for actual usage. This is ideal for short-term or test tasks, as you can release the instance at any time to save costs.

      Resource Group Settings

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

      Instance Class

      DTS offers synchronization specifications at different performance levels that affect the synchronization rate. Select a specification based on your business requirements. For more information, see Data synchronization link specifications.

      Subscription Duration

      In subscription mode, select the duration and quantity of the instance. Monthly options range from 1 to 9 months. Yearly options include 1, 2, 3, or 5 years.

      Note

      This option appears only when the billing method is Subscription.

    3. Read and select the checkbox for Data Transmission Service (Pay-as-you-go) Service Terms.

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

      You can monitor the task progress on the data synchronization page.

Mapping information

  1. In the Selected Objects list, hover the pointer over the destination topic name.

  2. Click Edit next to the destination topic name.

  3. In the dialog box, configure the mapping information.

    Note
    • If mapping is configured at both the database level and table level, the table-level mapping takes precedence.

    • For database-level mapping, use the Edit Schema dialog box. For table-level mapping, use the Edit Table dialog box.

    Database level

    Parameter

    Description

    Schema Name

    The destination topic to which the synchronized data is written. By default, this is the Topic you selected for the Destination Database in the Configurations for Source and Destination Databases step.

    Important
    • The specified topic name must exist in the destination Message Queue for RocketMQ instance. Otherwise, the data synchronization task fails.

    • If you change the Schema Name, data is written to the specified topic.

    Select DDL and DML Operations to Be Synchronized

    Select the SQL operations for incremental synchronization.

    Table level

    Parameter

    Description

    Table Name

    The destination topic to which the synchronized data is written. By default, this is the Topic you selected for the Destination Database in the Configurations for Source and Destination Databases step.

    Important
    • The specified topic name must exist in the destination Message Queue for RocketMQ instance. Otherwise, the data synchronization task fails.

    • If you change the Table Name, data is written to the specified topic.

    Filter Conditions

    For more information, see Set Filter Conditions.

    Select DDL and DML Operations to Be Synchronized

    Select the SQL operations for incremental synchronization.

    Partition Key

    If you set Rules of the ordered messages delivered to RocketMQ. to Deliver data based on hash values of a specified column., you can specify one or more columns as the partition key. DTS then delivers rows to different partitions of the destination topic based on the hash value calculated from the key.

  4. Click OK.