Data Transmission Service (DTS) migrates data from a self-managed TiDB database to an AnalyticDB for MySQL V3.0 cluster. DTS supports schema migration, full data migration, and incremental data migration.
How migration works
The migration runs in up to three sequential phases:
Schema migration — DTS replicates table definitions to the destination cluster.
Full data migration — DTS reads all existing data from TiDB and loads it into AnalyticDB for MySQL V3.0.
Incremental data migration (optional) — DTS reads change events from a Kafka cluster and applies them to the destination, keeping source and destination in sync during cutover.
Choose your path:
Full migration only (schema + full data): Complete Prerequisites, then go to Create a migration task.
Full + incremental migration: Complete Prerequisites, then Set up incremental data collection, then Create a migration task.
Prerequisites
Before you begin:
Create an AnalyticDB for MySQL V3.0 cluster with available storage larger than the total size of data in the source TiDB database. See Create a cluster.
Grant the required database account permissions listed in Required permissions.
(Incremental migration only) Set up a Kafka cluster. See Set up incremental data collection.
Required permissions
Database | Required permissions |
TiDB database | SELECT on objects to migrate, SHOW VIEW |
AnalyticDB for MySQL V3.0 cluster | Read and write permissions on the destination database. See Create a database account. |
Billing
Migration type | Instance configuration fee | Internet traffic fee |
Schema migration and full data migration | Free | Charged only when Access Method for the destination is Public IP Address. See Billing overview. |
Incremental data migration | Charged. See Billing overview. |
Set up incremental data collection
Skip this section if you only need schema migration and full data migration.
Incremental data migration requires TiDB to stream change events to a Kafka cluster. Choose one of the following methods based on your TiDB version.
Choose a method
Method | When to use |
TiDB Binlog | TiDB clusters that already use Pump and Drainer for binlog replication |
TiCDC | TiDB v4.0 and later; preferred for new deployments |
Configure Kafka parameters
Before connecting to DTS, increase the following Kafka parameters. Without these changes, the Kafka cluster may reject large binary log payloads from TiDB.
Component | Parameter | Action |
Kafka broker |
| Increase to accommodate TiDB binary log messages |
Kafka broker |
| Increase to match |
Kafka consumer |
| Increase to match broker |
Prepare a Kafka cluster
Use one of the following options:
Self-managed Kafka cluster — Deploy your own cluster. See the Apache Kafka official website.
ApsaraMQ for Kafka instance — Create a managed instance. See Getting started overview. Deploy the instance in the same virtual private cloud (VPC) as the TiDB database server.
Deploy the TiDB database server, Pump (if using TiDB Binlog), Drainer, and the Kafka cluster in the same internal network to minimize network latency.
After the Kafka cluster is ready, create a topic with exactly one partition. DTS reads only from partition ID 0. Additional partitions cause data loss.
Use TiDB Binlog
Deploy Pump and Drainer on servers in the same internal network as the TiDB database. See TiDB Binlog cluster deployment.
Edit the Drainer configuration file to point to the Kafka cluster. See Binlog consumer client user guide.
Verify that the TiDB server can reach the Kafka cluster.
Add the CIDR blocks of DTS servers to the TiDB database allowlist. See Add the CIDR blocks of DTS servers.
Use TiCDC
Install TiCDC using TiUP to add a new TiCDC node or scale out an existing node in the TiDB cluster. See Deploy and maintain TiCDC.
Create a changefeed to replicate incremental data to Kafka. Use
tiup cdc cli changefeed createas the starting command. See Replicate data to Kafka.Verify that the TiDB server can reach the Kafka cluster.
Limitations
Review these limitations before starting the task.
Source database
The TiDB server must have sufficient outbound bandwidth. Low bandwidth reduces migration speed.
Tables to migrate must have PRIMARY KEY or UNIQUE constraints with all fields unique. Tables without these constraints may produce duplicate records in the destination.
If you rename tables or columns during migration, a single task supports up to 1,000 tables. For more than 1,000 tables, split the migration into multiple tasks or migrate the entire database in one task.
If you want to migrate incremental data from the source TiDB database, you must deploy a Kafka cluster and install related components for the TiDB database to collect the incremental data.
Prefix indexes cannot be migrated. If the source database contains prefix indexes, the migration task may fail.
Incremental migration
DTS reads data only from partition ID 0 of the Kafka topic. Configure the topic with exactly one partition.
After creating an incremental migration task, perform operations on the source database or insert test data promptly to update the task's offset information. Long delays before the first data event can cause the task to fail.
Destination and task behavior
Specify a custom primary key in the destination database or configure Primary Key Column in the Configurations for Databases, Tables, and Columns step. Missing primary key configuration causes data migration to fail.
If the AnalyticDB for MySQL V3.0 cluster is being backed up while the DTS task runs, the task fails.
If disk usage on AnalyticDB for MySQL V3.0 nodes exceeds 80%, the migration task is delayed and errors are returned. Estimate required disk space before starting.
Full data migration increases load on both source and destination databases. Run migrations during off-peak hours when CPU load is below 30%.
Full data migration uses concurrent INSERT operations, which cause fragmentation in destination tables. After full migration completes, the destination tablespace size is larger than the source.
If other sources write to the destination during migration, data inconsistency may occur.
DTS uses the
ROUND(COLUMN,PRECISION)function to retrieve FLOAT and DOUBLE values. The default precision is 38 digits for FLOAT and 308 digits for DOUBLE. Verify that these defaults meet your requirements before starting.During schema migration, DTS does not support migrating materialized views to the destination AnalyticDB for MySQL instance. To use materialized views, manually create them in the destination instance after migration is complete.
DTS automatically attempts to resume failed tasks for up to seven days. Before switching workloads to the destination, stop or release any failed tasks, or run the
REVOKEstatement to remove write permissions from the DTS accounts. Otherwise, a resumed task may overwrite destination data.If DDL statements fail in the destination, the DTS task continues running. View failed DDL statements in task logs. See View task logs.
If a DTS task fails, DTS technical support attempts to restore it within 8 hours. During restoration, the task may be restarted and task parameters (not database parameters) may be modified. For a list of parameters that may change, see Modify instance parameters.
If the destination is an AnalyticDB for MySQL cluster, DTS only supports writing data types that are natively supported by AnalyticDB for MySQL. This includes basic data types and complex data types such as ARRAY, MAP, and JSON. Data types such as MULTIVALUE are not supported.
Supported SQL operations for incremental migration
Operation type | Supported statements |
DML | INSERT, UPDATE, DELETE. UPDATE statements are automatically converted to REPLACE INTO. If UPDATE targets the primary key, it is converted to DELETE followed by INSERT. |
DDL | CREATE TABLE, DROP TABLE, RENAME TABLE, TRUNCATE TABLE, ADD COLUMN, DROP COLUMN |
Data type mappings
For the full mapping between TiDB and AnalyticDB for MySQL V3.0 data types, see Data type mappings between heterogeneous databases.
Create a migration task
Step 1: Go to the Data Migration page
Use either the DTS console or the DMS console.
DTS console
Log on to the DTS console.
In the left-side navigation pane, click Data Migration.
In the upper-left corner, select the region where the migration instance will reside.
DMS console
Steps may vary based on the DMS console mode and layout. See Simple mode and Customize the layout and style of the DMS console.
Log on to the DMS console.
In the top navigation bar, move the pointer over Data + AI > DTS (DTS) > Data Migration.
From the drop-down list to the right of Data Migration Tasks, select the region where the migration instance will reside.
Step 2: Configure source and destination databases
Click Create Task.
Enter a Task Name. DTS generates a name automatically; specify a descriptive name to make the task easy to identify later.
Configure the source database:
Parameter
Description
Select Existing Connection
Select a registered database instance to auto-fill the parameters below, or leave blank and enter connection details manually.
Database Type
Select TiDB.
Access Method
Select the access method based on where TiDB is deployed. This example uses Self-managed Database on ECS. For other access methods, prepare the required environment first. See Preparation overview.
Instance Region
The region where the TiDB database resides.
ECS Instance ID
The ID of the ECS instance hosting TiDB.
Port Number
The TiDB service port. Default: 4000.
Database Account
The TiDB database account.
Database Password
The password for the database account.
Migrate Incremental Data
Select Yes if you want incremental data migration, then enter the Kafka cluster details in the Kafka cluster configuration section.
Configure the destination database:
Parameter
Description
Select Existing Connection
Select a registered instance to auto-fill the parameters below, or leave blank and enter connection details manually.
Database Type
Select AnalyticDB for MySQL 3.0.
Access Method
Select Alibaba Cloud Instance.
Instance Region
The region where the destination cluster resides.
Instance ID
The ID of the destination AnalyticDB for MySQL V3.0 cluster.
Database Account
The database account for the destination cluster. See Required permissions.
Database Password
The password for the database account.
Click Test Connectivity and Proceed. In the CIDR Blocks of DTS Servers dialog box, click Test Connectivity.
DTS CIDR blocks must be added to the security settings of both source and destination databases. See Add the CIDR blocks of DTS servers.
Step 3: Configure objects to migrate
On the Configure Objects page, set the following parameters:
Parameter | Description |
Migration Types | Select the migration phases to run: Schema Migration, Full Data Migration, and optionally Incremental Data Migration. If Schema Migration is not selected, create the destination database and table before starting the task. If Incremental Data Migration is not selected, avoid writing to the source database during migration to maintain data consistency. |
Merge Tables | Yes adds a |
Processing Mode of Conflicting Tables | Precheck and Report Errors: fails the precheck if source and destination have tables with the same name. Use object name mapping to rename conflicting tables before starting. Ignore Errors and Proceed: skips the precheck. During full migration, DTS keeps existing destination records for conflicting primary keys. During incremental migration, DTS overwrites them. If schemas differ between source and destination, only matching columns are migrated or the task may fail. |
Capitalization of Object Names in Destination Instance | Controls the case of database, table, and column names in the destination. Default: DTS default policy. See Specify the capitalization of object names in the destination instance. |
Source Objects | Select tables or databases to migrate, then click the arrow icon to move them to Selected Objects. |
Selected Objects | Right-click an object to rename it or add WHERE filter conditions. Click Batch Edit to rename multiple objects at once. Renaming an object may cause dependent objects to fail migration. |
Click Next: Advanced Settings.
Step 4: Configure advanced settings
Parameter | Description |
Retry Time for Failed Connections | How long DTS retries after a connection failure. Valid range: 10–1,440 minutes. Default: 720 minutes. Set to at least 30 minutes. If multiple tasks share the same source or destination database, the most recently set value applies. DTS charges for the instance during retry periods. |
Retry Time for Other Issues | How long DTS retries after DDL or DML failures. Valid range: 1–1,440 minutes. Default: 10 minutes. Set to at least 10 minutes. Must be smaller than Retry Time for Failed Connections. |
Enable Throttling for Full Data Migration | Limits read/write resource usage during full migration. Configure QPS (queries per second) 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 resource usage 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. |
Environment Tag | An optional tag to identify the DTS instance. |
Configure ETL | Select Yes to enable extract, transform, and load (ETL) and enter data processing statements. See Configure ETL in a data migration or data synchronization task. Select No to skip. |
Monitoring and Alerting | Select Yes to receive notifications when the task fails or migration latency exceeds a threshold. Configure alert thresholds and contacts. See Configure monitoring and alerting. |
Step 5: Configure data verification (optional)
Click Next Step: Data Verification to set up a data verification task. See Configure a data verification task.
Step 6: Configure database and table fields (optional)
Click Next: Configure Database and Table Fields to set the Type, Primary Key Column, Distribution Key, Partition Key, Partitioning Rules, and Partition Lifecycle for destination tables.
This step is available only if Schema Migration is selected. Set Definition Status to All to view and edit all tables. To form a composite primary key, specify multiple columns in Primary Key Column and designate one or more as the Distribution Key and Partition Key. See CREATE TABLE.
Step 7: Run the precheck
Click Next: Save Task Settings and Precheck.
To view the API parameters for this task configuration, hover over the button and click Preview OpenAPI parameters before proceeding.
DTS runs a precheck before starting the migration. If the precheck fails:
Click View Details next to the failed item, resolve the issue, and click Precheck Again.
For alert items that can be safely ignored, click Confirm Alert Details > Ignore > OK, then click Precheck Again. Ignoring alerts may result in data inconsistency.
Step 8: Purchase an instance and start the task
Wait until Success Rate reaches 100%, then click Next: Purchase Instance.
On the Purchase Instance page, configure the following:
Parameter
Description
Resource Group
The resource group for the migration instance. Default: default resource group. See What is Resource Management?.
Instance Class
The instance class determines migration speed. See Instance classes of data migration instances.
Read and accept the Data Transmission Service (Pay-as-you-go) Service Terms.
Click Buy and Start, then click OK in the confirmation dialog.
Monitor task progress on the Data Migration page.
Tasks without incremental migration stop automatically when complete. Status shows Completed.
Tasks with incremental migration run continuously. Status shows Running. Stop the task manually after cutover.
Kafka cluster configuration
When Migrate Incremental Data is set to Yes, configure the Kafka cluster with the following parameters:
Parameter | Description |
Kafka Cluster Type | The deployment location of the Kafka cluster. This example uses Self-managed Database on ECS. If you select Express Connect, VPN Gateway, or Smart Access Gateway, also select a VPC from Connected VPC and specify Domain Name or IP. |
Kafka Data Source Component | Select Use the default binlog format of the TiDB database or Use the TiCDC Canal-JSON format based on your setup. |
ECS Instance ID | The ID of the ECS instance hosting the Kafka cluster. |
Port Number | The Kafka service port. |
Kafka Cluster Account | The Kafka username. Leave blank if authentication is disabled. |
Kafka Cluster Password | The Kafka password. Leave blank if authentication is disabled. |
Kafka Version | The Kafka cluster version. Select 1.0 if the version is 1.0 or later. |
Encryption | Select Non-encrypted or SCRAM-SHA-256 based on your security requirements. |
Topic | The Kafka topic that receives incremental data. |