Data Transmission Service (DTS) is a data streaming service provided by Alibaba Cloud that supports data transmission between data sources, such as Relational Database Management System (RDBMS), NoSQL, and Online Analytical Processing (OLAP) databases. This topic describes how to configure migration tasks in DTS to migrate an on-premises self-managed database to a self-managed database on an Elastic Compute Service (ECS) instance. In the examples, a MySQL database is used.
Prerequisites
An ECS instance is created. For more information, see Create an instance on the Custom Launch tab.
The port on which MySQL listens is opened in the security groups of the ECS instance. By default, MySQL listens on port 3306. For more information, see Add a security group rule.
A MySQL database is installed on the ECS instance. For more information, see Deploy databases.
Non-root accounts are created for an on-premises MySQL database and the MySQL database on the ECS instance.
For example, you can run the following commands to create a MySQL account whose username is dts and password is
Test@123456:# Step 1: Create a user and specify a password for the user. 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 provided by DTS allows you to migration data between homogeneous and heterogeneous data sources. The data migration feature also supports the Extract, Transform, and Load (ETL) features, such as data filtering and object name mapping based on the database, table, and column. You can use DTS for zero-downtime migration to minimize impacts on your business. During data migration, the source database continues to provide services as expected. For information about the database types supported by DTS, see Data migration.
Procedure
Log on to the DTS console.
In the left-side navigation pane, click Data Migration.
Select the region where the ECS instance resides and click Create Task.
Configure a migration task.
Specify a task name.
DTS automatically generates a task name. We recommend that you specify a descriptive name to facilitate task identification. You do not need to specify a unique task name. You can use the default name or specify a custom name.
Configure the source database.
NoteIf you created Data Management (DMS) database instances, you can select an existing instance to configure the source database.
DTS supports several methods to access self-managed databases. In this example, a self-managed database that can be accessed over the Internet is used. For information about how to migrate the data of other types of databases, see Overview of data migration scenarios.
Parameter
Description
Database Type
The type of the on-premises self-managed database. Example: MySQL.
Access Method
The method that is used to access the on-premises self-managed database. Example: Public IP Address.
Instance Region
The region in which the on-premises self-managed database resides. Example: China (Hangzhou).
Domain Name or IP
The domain name or IP address of the on-premises database.
Port Number
The port on which MySQL listens. Default value: 3306.
Database Account
The non-root account used to access the on-premises self-managed MySQL database.
ImportantIf the account is not a non-root account, an error occurs when you test connectivity.
Database Password
The password of the non-root account.
Encryption
Specifies whether to encrypt the connection to the source database. Select Non-encrypted or SSL-encrypted based on your business requirements.
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. In this case, you must upload a CA Certificate and configure the CA Key parameter.
Configure the destination database.
Parameter
Description
Database Type
The type of the destination database. This database type must be the same as the type of the on-premises self-managed database. Example: MySQL.
Access Method
The method used to access the destination database. Select Self-managed Database on ECS.
Instance Region
The region where the ECS instance resides. Example: China (Beijing).
ECS Instance ID
The ID of the ECS instance. DTS supports ECS instances that reside in the classic network and virtual private clouds (VPCs).
Port Number
The port on which MySQL listens. Default value: 3306.
Database Account
The non-root account used to access the MySQL database that is hosted on the ECS instance.
ImportantIf the account is not a non-root account, an error occurs when you test connectivity.
Database Password
The password of the non-root account.
Encryption
Specifies whether to encrypt the connection to the database instance. Select Non-encrypted or SSL-encrypted based on your requirements.
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 migration types and objects.
Configure 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 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 to configure advanced parameters as prompted.
Click Next: Data Verification to configure a data verification task.
Click Next: Save Task Settings and Precheck. After the precheck is passed, click Next: Purchase Instance. Confirm the information and cost, and then purchase the destination instance.
Before the migration task starts, DTS checks items such as connectivity, permissions, and log formats. The following figure shows that the precheck is successful.

After you purchase the destination instance, you can view the status and progress of the migration task in the Data Migration Tasks section.

References
DTS allows you to migrate data between homogeneous data sources or between heterogeneous data sources. Typical scenarios include data migration to Alibaba Cloud, data migration between instances within Alibaba Cloud, and database sharding and scaling. For information about migration scenarios, see Overview of data migration scenarios.