Data Transmission Service (DTS) is an Alibaba Cloud service that supports data exchange between various data sources, such as relational database management systems (RDBMS), NoSQL, and online analytical processing (OLAP) databases. This topic uses a MySQL database as an example to describe how to configure a DTS migration task to migrate data from an on-premises self-managed database to a self-managed database on an Elastic Compute Service (ECS) instance.
Prerequisites
Create an ECS instance. For more information, see Create a custom instance.
Add a security group rule to the ECS instance to allow traffic on the MySQL listener port, which is 3306 by default. For more information, see Add a security group rule.
The ECS instance has a MySQL database installed. For more information, see Deploy a database.
You have created a non-root account for the local MySQL database and another for the MySQL database on an ECS instance.
For example, run the following commands to create a MySQL account with the username dts and the password
Test@123456.# Step 1: Create a user and set a password. CREATE USER 'dts'@'%' IDENTIFIED BY 'Test@123456'; # Step 2: Grant permissions. GRANT ALL PRIVILEGES ON *.* TO 'dts'@'%'; # Step 3: Refresh permissions. FLUSH PRIVILEGES;
Background information
The data migration feature of DTS supports data migration between homogeneous and disparate data sources. It also provides extract, transform, and load (ETL) features, such as data filtering and object name mapping at the database, table, and column levels. You can use DTS to perform a zero-downtime migration. This allows the source database to remain operational during the migration and minimizes the impact on your business. For more information about the database types that DTS supports, see Data migration.
Procedure
Log on to the DTS console.
In the navigation pane on the left, click Data Migration.
Select the region of the ECS instance and click Create Task.
Configure the migration task.
Configure the task name.
DTS automatically generates a task name. Specify a descriptive name for easy identification. The name does not need to be unique.
Configure the source database.
NoteIf you have created a DMS database instance, you can select the existing instance to quickly configure the source database.
DTS supports multiple connection types for self-managed databases. This topic uses a self-managed database that is connected over the Internet as an example. For information about migration solutions for other database types, see Overview of migration solutions.
Parameter Name
Parameter value
Database Type
The type of the on-premises database. In this example, the type is MySQL.
Connection Type
A self-managed database with a public IP address. Select Public IP.
Instance Region
The region where the on-premises database is located. In this example, select China (Hangzhou).
Domain Name or IP Address
The endpoint of the on-premises database.
Port
The port that the MySQL database uses. The default port is 3306.
Database Account
The non-root account for the on-premises MySQL database.
ImportantYou must enter a non-root account. Otherwise, the connection test fails.
Database Password
The password for the non-root account.
Connection Type
Select Non-encrypted or SSL-encrypted as needed.
If SSL encryption is not enabled for the self-managed MySQL database, select Non-encrypted.
If SSL encryption is enabled for the self-managed MySQL database, select SSL-encrypted. You also need to upload a CA Certificate and enter the CA Key.
Configure the destination database.
Parameter Name
Parameter value
Database Type
The same as the type of the on-premises self-managed database. In this example, the type is MySQL.
Connection Type
Select Self-managed Database on ECS.
Instance Region
The region where the ECS instance is located. In this example, select China (Beijing).
ECS Instance ID
The ID of the ECS instance. DTS supports ECS instances in the classic network and in virtual private clouds (VPCs).
Port
The port that the MySQL database uses. The default port is 3306.
Database Account
The non-root account for the MySQL database on the ECS instance.
ImportantYou must enter a non-root account. Otherwise, the connection test fails.
Database Password
The password for the non-root account.
Connection Type
Select Non-encrypted or SSL Secure Connection as needed.
If an IP address whitelist is configured for your self-managed database, add the CIDR blocks of DTS servers to the IP address whitelist. Then, click Test Connectivity.
WarningIf the public CIDR blocks of DTS servers are automatically or manually added to the whitelist of a database instance or to the security group rules of an ECS instance, security risks may arise. Therefore, before you use DTS to migrate data, you must understand and acknowledge the potential risks and take preventive measures, including but not limited to the following measures: enhancing the security of your username and password, limiting the ports that are exposed, authenticating API calls, regularly checking the whitelist or security group rules and forbidding unauthorized CIDR blocks, or connecting the database instance to DTS by using Express Connect, VPN Gateway, or Smart Access Gateway.
Configure the migration types and migration objects.
Configure the migration types.
To perform only full data migration, select Schema Migration and Full Data Migration.
To ensure service continuity during data migration, select Schema Migration, Full Data Migration, and Incremental Data Migration.
NoteIf you do not select Schema Migration, make sure a database and a table are created in the destination database to receive data and the object name mapping feature is enabled in Selected Objects.
If you do not select Incremental Data Migration, we recommend that you do not write data to the source database during data migration. This ensures data consistency between the source and destination databases.
Configure the migration objects.
Select one or more objects from the Source Objects section. Click the
icon and add the objects to the Selected Objects section. NoteYou can select columns, tables, or databases as the objects to be migrated. If you select tables or columns as the objects to be migrated, DTS does not migrate other objects, such as views, triggers, or stored procedures, to the destination database.
Click Next: Advanced Settings and follow the prompts to configure the advanced parameters.
Click Next: Data Validation to configure a data validation task.
Click Next: Save Task and Precheck. After the precheck passes, click Next: Purchase. Verify the information and cost, and then complete the purchase.
Before the migration task starts, DTS runs a precheck on items such as connectivity, permissions, and log formats. The following figure shows a successful precheck.

After the purchase, you can view the status and progress of the migration task on the Migration Tasks list.

References
The data migration feature migrates data between homogeneous or disparate data sources to support business scenarios such as migrating data to the cloud, migrating data between instances within Alibaba Cloud, and database sharding and scale-out. For more information about migration scenarios, see Overview of migration solutions.