All Products
Search
Document Center

Data Transmission Service:Migrate data from an RDS for MySQL instance to an ApsaraMQ for RocketMQ instance

Last Updated:Apr 01, 2026

Data Transmission Service (DTS) can migrate data from a MySQL database—including self-managed MySQL databases or RDS for MySQL instances—to an ApsaraMQ for RocketMQ instance. This topic describes how to migrate data from an RDS for MySQL instance.

The migration workflow has four main steps:

  1. Verify that the source RDS for MySQL instance and destination ApsaraMQ for RocketMQ instance meet all prerequisites.

  2. Create a DTS task and configure the source and destination connections.

  3. Select migration objects and configure message format and ordering rules.

  4. Configure advanced settings, run a precheck, and purchase the migration instance.

Prerequisites

Before you begin, ensure that you have:

  • A destination ApsaraMQ for RocketMQ instance that is not a Serverless instance. For more information, see Manage instances (4.x series) or Manage instances (5.x series)

  • A topic created in the destination instance to receive data. For more information, see Manage topics (4.x series) or Manage topics (5.x series)

    • For 4.x series instances, set Message Type to Partitionally Ordered Message

    • For 5.x series instances, set Message Type to Ordered Message

  • Read permissions granted to the database account on the migration objects. See Required permissions

For supported source and destination database versions, see Migration solutions.

Billing

Migration type Instance configuration fee
Full data migration Free of charge
Incremental data migration Charged. For more information, see Billing overview.

Limitations

Source database requirements

Migration objects

  • Tables must have a primary key or UNIQUE constraint, with all fields unique. Without this, the destination may contain duplicate records.

  • If you rename tables or columns at the destination, a single task can migrate up to 1,000 tables. Exceeding this limit causes a request error. Split the work across multiple tasks, or migrate at the database level instead of the table level.

Binary log requirements for incremental migration

To replicate incremental changes, the source MySQL instance must have binary logging enabled and configured as follows:

Parameter Required value
binlog_format row
binlog_row_image full
log_slave_updates ON (required only for dual-primary cluster deployments)

For the binlog retention period:

Insufficient retention may cause DTS to fail to obtain binary logs, which can result in task failure or, in exceptional cases, data inconsistency or loss. Retaining logs for less than the minimum period means the Service Level Agreement (SLA) guarantees may not apply.

DDL and DML restrictions

  • Do not run DDL operations to change database or table schemas during the full data migration phase. DTS queries the source database during full migration, which creates metadata locks that can block DDL operations.

  • If you run full data migration only (without incremental), do not write new data to the source during migration. To maintain real-time consistency, select both full data migration and incremental data migration.

Other source limitations

  • Data changes recorded in binary logs—such as data restored from a physical backup or data from a cascade operation—are not migrated. If such data is missing at the destination, you can re-run a full migration as long as your business is not affected.

  • If the source is MySQL 8.0.23 or later and the data includes invisible columns, those columns cannot be migrated and data loss occurs.

Destination instance requirements

  • Serverless ApsaraMQ for RocketMQ instances are not supported as a destination.

  • The maximum message body size is 4 MB.

  • If the destination instance is in a different region from the source, DTS accesses the destination through its public endpoint, which incurs data transfer costs. Enable public access for the destination instance before starting the task.

    • To check the internet access status: open the Instance Details page in the ApsaraMQ for RocketMQ console and check the Basic Information tab.

    • For pricing, see Internet traffic pricing (4.x series).

  • Upgrading or downgrading the destination instance class causes messages to be delivered under a new rule configuration.

General limitations

  • Do not write data to the destination from other sources during migration. External writes may cause data inconsistency.

  • Do not use tools such as pt-online-schema-change to run online DDL operations on migration objects in the source during migration.

  • Full data migration uses concurrent INSERT operations, which causes table fragmentation at the destination. After migration, table storage at the destination will be larger than at the source.

  • Run migration during off-peak hours, when the CPU load of both databases is below 30%. DTS consumes read and write resources from both the source and destination during full data migration, which can increase database load.

  • If the always-encrypted (EncDB) feature is enabled on the source RDS for MySQL instance, full data migration is not supported. Transparent Data Encryption (TDE) does not have this restriction—TDE-enabled instances support both full and incremental migration.

  • If an instance fails, DTS technical support attempts to recover it within 8 hours. During recovery, the DTS instance parameters may be adjusted, but the source and destination database parameters are not modified.

Special cases for self-managed MySQL sources

  • If a primary/secondary switchover occurs on the source while the migration task is running, the task fails.

  • DTS executes CREATE DATABASE IF NOT EXISTS \test\`` on the source on a schedule to advance the binary log file position.

  • Migration latency is calculated based on the timestamp of the latest migrated data at the destination compared to the current timestamp in the source. If no DML operations are performed on the source for an extended period, the displayed latency may be inaccurate. Run a DML operation on the source to refresh the latency value. If you are migrating an entire database, consider creating a heartbeat table that receives data every second.

Special cases for RDS for MySQL sources

  • A read-only RDS for MySQL V5.6 instance (which does not record transaction logs) cannot be used as a source for incremental data migration.

  • DTS executes CREATE DATABASE IF NOT EXISTS \test\`` on the source on a schedule to advance the binary log file position.

SQL operations that can be incrementally migrated

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

Permissions required for database accounts

Database Required permissions How to create and grant permissions
Source RDS for MySQL Read permissions on the migration objects Create an account and Modify account permissions
If the database account was not created in the RDS for MySQL console, make sure the account has the REPLICATION CLIENT, REPLICATION SLAVE, SHOW VIEW, and SELECT permissions.

Create a migration task

Step 1: Open the Data Migration page

Use one of the following methods to open the Data Migration page and select the region where the migration instance will reside.

DTS console

  1. Log on to the DTS console.

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

  3. In the upper-left corner of the page, select the target region.

DMS console

The actual navigation path may vary based on your DMS console mode and layout. For more information, see Simple mode and Customize the layout and style of the DMS console.
  1. Log on to the DMS console.

  2. In the top navigation bar, go to Data + AI > DTS (DTS) > Data Migration.

  3. From the drop-down list to the right of Data Migration Tasks, select the target region.

Step 2: Configure the source and destination

Click Create Task to open the task configuration page. Configure the source and destination as described in the following table.

Category Parameter Description
N/A Task Name The name of the DTS task. DTS generates a name automatically. Specify a descriptive name that makes the task easy to identify. The name does not need to be unique.
Source Database Select Existing Connection If the source instance is registered with DTS, select it from the drop-down list. DTS populates the remaining parameters automatically. Otherwise, configure the parameters below.
Database Type Select MySQL.
Access Method Select Alibaba Cloud Instance.
Instance Region Select the region where the source RDS for MySQL instance resides.
Replicate Data Across Alibaba Cloud Accounts Select No if the source 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 instance. For permission requirements, see Permissions required for database accounts.
Database Password Enter the password for the database account.
Encryption Select Non-encrypted or SSL-encrypted based on your security requirements. To use SSL encryption, enable SSL on the RDS for MySQL instance before configuring the DTS task. For more information, see Use a cloud certificate to enable SSL encryption.
Destination Database Select Existing Connection If the destination instance is registered with DTS, select it from the drop-down list. DTS populates the remaining parameters automatically. Otherwise, configure the parameters below.
Database Type Select RocketMQ.
Access Method Select Alibaba Cloud Instance.
Instance Region Select the region where the destination ApsaraMQ for RocketMQ instance resides.
RocketMQ version Select the version of the destination instance.
Instance ID Select the ID of the destination ApsaraMQ for RocketMQ instance.
Database Account Enter the account credentials for the destination instance. Required only if RocketMQ version is set to 5.x. Retrieve the credentials on the Intelligent Identity Recognition tab of the Access Control page in the ApsaraMQ for RocketMQ console.
Database Password Enter the password for the destination account.
Topic Select the topic to receive data.
Topic That Stores DDL Information Select the topic to store DDL information. If left blank, DDL information is stored in the topic selected for Topic.

Step 3: Test connectivity

Click Test Connectivity and Proceed.

Make sure that the CIDR blocks of DTS servers are added—automatically or manually—to the security settings of the source and destination databases. For more information, see Add DTS server IP addresses to a whitelist. If the source or destination is a self-managed database and Access Method is not set to Alibaba Cloud Instance, click Test Connectivity in the CIDR Blocks of DTS Servers dialog box.

Step 4: Select migration objects

On the Configure Objects page, configure the migration settings.

Parameter Description
Migration Types Select Full Data Migration for a one-time copy. Select both Full Data Migration and Incremental Data Migration to keep the destination in sync during migration. If you select full data migration only, do not write to the source during migration to avoid data inconsistency.
Processing Mode of Conflicting Tables Precheck and Report Errors (recommended): checks for identically named tables in the source and destination before the task starts. If conflicts are found, the precheck fails and the task cannot start. Use the object name mapping feature to resolve naming conflicts. For more information, see Map object names.
Ignore Errors and Proceed: skips the naming conflict check. Use with caution—data inconsistency may result: during full migration, conflicting records in the destination are retained; during incremental migration, they are overwritten. If schemas differ between source and destination, only certain columns may be migrated or the task may fail.
Format of the data delivered to RocketMQ. Select the message format for data written to the destination topic. For more information, see Data formats in message queues.
Synchronize all fields Available only when Format of the data delivered to RocketMQ. is set to Canal JSON. Controls whether the pre-image (original row values before an UPDATE) includes all columns or only the updated columns. Yes: the pre-image includes all columns in the row. No (default): the pre-image includes only the updated columns. Choose Yes for use cases such as auditing or reconciliation where you need the full before-image of each change.
Rules of the ordered messages delivered to RocketMQ. Select the message ordering rule for the destination topic. For more information, see Message order rules for RocketMQ .
Name of DTS producer group The producer group (ProducerGroup) that sends messages to the destination topic. Default value: dts-producer-group. For more information, see Producers.
Limits of RocketMQ messaging transactions per second (TPS) The maximum TPS when writing to the destination topic. The value must not exceed the maximum TPS of the ApsaraMQ for RocketMQ instance. For instance TPS limits, see Instance type limits. The actual TPS may fluctuate slightly around the configured value.
Whether to filter large size of records. Select whether to filter out message bodies larger than 4 MB. If set to No and a message body exceeds 4 MB, the migration instance fails.
Capitalization of Object Names in Destination Instance The capitalization policy for database names, table names, and column names in the destination. Default: DTS default policy. For more information, see Specify the capitalization of object names in the destination instance.
Source Objects Select the databases or tables to migrate and click the arrow icon to add them to Selected Objects.
Selected Objects The selected migration objects. Use the mapping feature to set the topic name, filter conditions, SQL operations, and partition key. For more information, see Mapping information.

Step 5: Configure advanced settings

Click Next: Advanced Settings.

Parameter Description
Dedicated Cluster for Task Scheduling By default, DTS schedules tasks to a shared cluster. Purchase a dedicated cluster to improve task stability. For more information, see What is a DTS dedicated cluster.
Retry Time for Failed Connections How long DTS retries failed connections after the task starts. Valid values: 10–1,440 minutes. Default: 720 minutes. Set to at least 30 minutes. If DTS reconnects within the retry window, the task resumes; otherwise, it fails. Note: if multiple tasks share the same source or destination, the most recently set retry time takes precedence. DTS charges for the instance during retries.
Retry Time for Other Issues How long DTS retries failed DDL or DML operations. Valid values: 1–1,440 minutes. Default: 10 minutes. Set to at least 10 minutes. This value must be less than Retry Time for Failed Connections.
Enable Throttling for Full Data Migration Limits the read and write rate during full data migration. Configure Queries per second (QPS) to the source database, RPS of Full Data Migration, and Data migration speed for full migration (MB/s). Available only when Full Data Migration is selected.
Enable Throttling for Incremental Data Migration Limits the rate during incremental migration. Configure RPS of Incremental Data Migration and Data migration speed for incremental migration (MB/s). Available only when Incremental Data Migration is selected.
Whether to delete SQL operations on heartbeat tables of forward and reverse tasks Controls whether DTS writes heartbeat table SQL operations to the source database while the instance runs. Yes: heartbeat operations are not written to the source. A migration latency may appear. No: heartbeat operations are written to the source. This may affect features such as physical backup and cloning of the source database.
Environment Tag An optional tag to identify the instance.
Configure ETL Enables the extract, transform, and load (ETL) feature. Yes: configure ETL in the code editor. For more information, see Configure ETL in a data migration or data synchronization task. No (default): ETL is disabled.
Monitoring and Alerting Configure alerts for task failure or high migration latency. No (default): no alerts. Yes: configure the alert threshold and notification settings. For more information, see Configure monitoring and alerting.

Step 6: Run the precheck

Click Next: Save Task Settings and Precheck.

Before you can start the migration task, DTS runs a precheck. The task starts only after the precheck passes.
If the precheck fails, click View Details next to each failed item, resolve the issue, and click Precheck Again.
If an alert is triggered: if the alert can be ignored, click Confirm Alert Details, then Ignore in the dialog box, and click Precheck Again. If the alert cannot be ignored, resolve the underlying issue before proceeding. Ignoring alerts may cause data inconsistency.

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

Step 7: Purchase the migration instance

  1. Wait until Success Rate reaches 100%, then click Next: Purchase Instance.

  2. On the Purchase Instance page, configure the following parameters.

Parameter Description
Resource Group The resource group for the migration instance. Default: default resource group. For more information, see What is Resource Management?
Instance Class The class determines migration speed. Select a class based on your workload. For more information, see Instance classes of data migration instances.
  1. Read and accept Data Transmission Service (Pay-as-you-go) Service Terms by selecting the check box.

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

After the task starts, track its progress on the Data Migration page:

  • Full data migration only: the task stops automatically when complete. The status shows Completed.

  • Full and incremental data migration: the incremental migration phase runs continuously and does not stop automatically. The status shows Running.

Mapping information

Use the mapping feature to configure how each migration object maps to a topic in the destination ApsaraMQ for RocketMQ instance.

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

  2. Click Edit next to the topic name.

  3. Configure the mapping in the dialog box.

If mapping is enabled at both the database and table levels, table-level mapping takes precedence. Database-level mapping is configured in the Edit Schema dialog box; table-level mapping is configured in the Edit Table dialog box.

Database-level mapping

Parameter Description
Schema Name The name of the destination topic. By default, this is the Topic selected in the Destination Database section. To write data to a different topic, enter its name here.
Select DDL and DML operations to be synchronized Select the SQL operations to include in incremental migration.

Table-level mapping

Parameter Description
Table Name The name of the destination topic. By default, this is the Topic selected in the Destination Database section. The specified topic must already exist in the destination instance. To write data to a different topic, enter its name here.
Filter Conditions For more information, see Set filter conditions.
Select DDL and DML operations to be synchronized Select the SQL operations to include in incremental migration.
Partition Key Available when Rules of the ordered messages delivered to RocketMQ. is set to Deliver data based on hash values of a specified column. Specify one or more columns as the partition key. DTS calculates a hash value from the key and routes rows to different partitions of the destination topic based on the result.