Migrate all existing data from a self-managed TiDB database to an ApsaraDB RDS for MySQL instance by using DTS.
Prerequisites
Create a destination ApsaraDB RDS for MySQL instance with more storage than the source TiDB database. Create an ApsaraDB RDS for MySQL instance.
-
This feature is available only in specific regions. The destination ApsaraDB RDS for MySQL instance must be in one of the following regions: China (Hangzhou), China (Shanghai), China (Qingdao), China (Beijing), China (Shenzhen), China (Zhangjiakou), China (Hong Kong), Singapore, US (Silicon Valley), or US (Virginia).
-
The storage of the destination instance must exceed that of the source TiDB database.
Usage notes
-
During a full data migration, DTS consumes read and write resources on the source and destination databases, increasing their load. If your databases have poor performance, low specifications, or high workloads (for example, if the source database has many slow SQL queries or tables without primary keys, or if deadlocks occur in the destination database), the increased load can strain your databases or even cause service interruptions. Perform the data migration during off-peak hours, such as when the CPU utilization of both databases is below 30%.
-
If a source table lacks a primary key or a unique constraint and contains non-unique data, duplicate data may be created in the destination database.
-
For columns with the FLOAT or DOUBLE data type, DTS reads their values by using the
ROUND(COLUMN,PRECISION)function. If the precision is not explicitly defined, DTS migrates FLOAT values with a precision of 38 digits and DOUBLE values with a precision of 308 digits. Verify that these precisions meet your business requirements. -
If a source database name violates ApsaraDB RDS naming conventions, you must create a compliant database in the destination instance before configuring the task. Otherwise, DTS creates the database automatically.
NoteFor more information about naming conventions and how to create a database, see Create a database and accounts.
-
If a data migration task fails, DTS automatically attempts to resume it. Before you switch your business workloads to the destination instance, make sure to stop or release the task. This prevents an automatically resumed task from overwriting data in the destination instance with data from the source database.
Billing
|
Type |
Link specification fee |
Public traffic fee |
|
Schema migration and full data migration |
Free. |
Data egress from Alibaba Cloud over the public network incurs charges. Billing overview. |
Migration types
|
Type |
Description |
|
Schema migration |
DTS migrates the schema definitions of selected objects to the destination database. Supported objects: databases, tables, and views. Warning
TiDB-to-MySQL migration involves heterogeneous databases. Data types may not be fully compatible. Evaluate the impact of data type mapping on your business. Data type mapping for heterogeneous databases. |
|
Full data migration |
DTS migrates all existing data from the selected objects to the destination database. Note
The destination tablespace may be larger than the source after migration due to table fragmentation from concurrent |
Preparations
If the source TiDB database uses a security whitelist, add the CIDR blocks of DTS servers to it. Add the IP address CIDR blocks of DTS servers to a whitelist.
Procedure
-
Log on to the DTS console.
NoteIf you are automatically redirected to the Data Management (DMS) console, you can click the
icon in the lower-right corner and then click
to return to the classic DTS console. -
In the left-side navigation pane, click Data Migration.
-
At the top of the Migration Tasks page, select the region of the destination cluster.
-
In the upper-right corner of the page, click Create Data Migration Task.
-
Configure the source and destination databases.

Category
Parameter
Description
N/A
Task name
DTS automatically generates a task name. Use a descriptive name for easy identification. The name does not need to be unique.
Source Database
Instance type
Select the deployment location of the source database. This example uses Self-managed database on an ECS instance.
NoteIf your self-managed database is of a different instance type, you may need to complete additional preparations. For more information, see Preparations for data migration.
Instance region
Select the region of the ECS instance that hosts the TiDB database.
Database type
Select TiDB.
Port
Enter the service port of the TiDB database. Default: 4000.
Database account
Enter the account for the TiDB database. The account must have SHOW VIEW and SELECT permissions on the objects to be migrated.
Database password
Enter the password for the database account.
ImportantAfter you enter the source database information, you can click Test Connectivity next to Database Password to verify that the information is correct. If the information is correct, the message Passed is displayed. If the message Failed is displayed, click Diagnose next to the Failed message and adjust the source database information based on the prompts.
Destination Database
Instance type
Select RDS Instance.
Instance region
Select the region of the destination RDS instance.
RDS instance ID
Select the ID of the destination RDS instance.
Database account
Enter the account for the destination RDS instance. The account must have read and write permissions on the destination database. Create an account and Modify account permissions.
Database password
Enter the password for the database account.
ImportantAfter you enter the destination database information, you can click Test Connectivity after Database Password to verify that the entered information is correct. If the information is correct, a Passed message is displayed. If a Failed message is displayed, click Diagnose after Failed and adjust the destination database information based on the prompts.
Connection method
Select Non-encrypted or SSL-encrypted as required. If you select SSL-encrypted, you must enable SSL encryption for the RDS instance beforehand. Set SSL encryption.
ImportantThe Encryption parameter is supported only in Chinese mainland regions and the China (Hong Kong) region.
-
Click Set Whitelist and Next.
If the source or destination is an Alibaba Cloud database instance (such as an ApsaraDB RDS for MySQL or ApsaraDB for MongoDB instance), DTS automatically adds the CIDR blocks of the DTS servers in the corresponding region to the whitelist of the database instance. If the source or destination is a self-managed database on an ECS instance, DTS automatically adds the CIDR blocks of the DTS servers in the corresponding region to the security rules of the ECS instance. You must also ensure that the self-managed database allows access from the ECS instance. If the database is a cluster deployed on multiple ECS instances, you must manually add the CIDR blocks of the DTS servers to the security rules of each ECS instance. If the source or destination is a self-managed database in an on-premises data center or another cloud, you must manually add the CIDR blocks of the DTS servers to allow access from them. For the CIDR blocks of DTS servers, see CIDR blocks of DTS servers.
WarningAdding the public CIDR blocks of DTS servers, whether automatically or manually, may introduce security risks. By using this product, you acknowledge and accept these potential risks. You are responsible for implementing basic security measures, including but not limited to using strong passwords, restricting open ports, using authentication for internal API calls, regularly reviewing and restricting unnecessary network segments, or connecting through private networks such as Express Connect, VPN Gateway, or Smart Access Gateway.
-
Select the migration types and migration objects.

Parameter
Description
Migration type
Select both Schema Migration and Full Data Migration. Migration types.
ImportantTo ensure data consistency, avoid DDL operations on the source database during the full data migration.
Migration objects
From the Available list, select the objects to migrate and click
to move them to the Selected Objects list.Important-
You can select databases, tables, or columns as the objects to migrate.
-
By default, migrated object names remain unchanged. To rename objects in the destination database, use the object name mapping feature. Map objects.
-
If you use object name mapping, other objects that depend on the renamed object may fail to migrate.
Change mapped name
Rename objects in the destination instance by using the object name mapping feature. Map objects.
Retry duration for unstable connections
Default: 12 hours. Specify a custom duration as needed. If DTS reconnects to both databases within this period, the task resumes automatically. Otherwise, the task fails.
NoteThe DTS instance incurs charges during retry. Specify a reasonable retry duration based on your needs, or release the DTS instance after the source and destination databases are released.
-
-
After you complete the configuration, click Precheck and Start in the lower-right corner of the page.
Note-
Before the migration task starts, DTS runs a precheck. The task can start only after it passes the precheck.
-
If the precheck fails, click the
icon next to the failed item to view details.-
Fix the issues as prompted and run the precheck again.
-
If you do not need to fix the warning items, you can select Ignore and then click Ignore Warnings and Rerun Precheck to run the precheck again.
-
-
-
After the task passes the precheck, click Next.
-
In the Confirm Settings dialog box that appears, select a Instance Class and select the Data Transmission Service (pay-as-you-go) Service Terms checkbox.
-
Click Purchase and Start. The migration task starts.
WarningDo not manually stop the task, or the migrated data may be incomplete. Wait for the task to finish; DTS stops it automatically upon completion.

Next steps
After the full data migration is complete, proceed with incremental data migration if needed. Migrate incremental data from a self-managed TiDB database to an ApsaraDB RDS for MySQL instance.