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. The default port on which MySQL listens is 3306. For more information, see Add a security group rule.
A MySQL database is installed on the ECS instance. For more information, see Database overview.
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 command to create a MySQL account whose username is dts and password is 123456:
grant all on *.* to 'dts'@'%' IDENTIFIED BY '123456';
Background information
DTS supports data migration between homogeneous and heterogeneous data sources. It also supports Extract, Transform, Load (ETL) features such as data mapping at three levels (databases, tables, and columns) and data filtering. 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 self-managed databases that can be accessed over the Internet or by using VPN Gateway, Express Connect, or Smart Access Gateway. In this example, a self-managed database that can be accessed over the Internet is used. For information about migration solutions for 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 where the on-premises self-managed database resides. Example: China (Hangzhou).
Hostname or IP address
The hostname or IP address of the host where the on-premises self-managed database resides.
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.
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.
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 and Proceed.
WarningIf the public CIDR blocks of DTS servers are automatically or manually added to the IP address 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 account and password, limiting the ports that are exposed, authenticating API calls, regularly checking the IP address whitelist or ECS security group rules and forbidding unauthorized CIDR blocks, and connecting the database to DTS by using Express Connect, VPN Gateway, or Smart Access Gateway.
Configure migration types and objects.
Configure migration types.
To perform zero-downtime data migration, select Schema Migration, Full Data Migration, and Incremental Data Migration.
NoteIf you do not select Incremental Data Migration, do not write new data to the on-premises database during data migration to ensure data consistency.
To perform full data migration, select Schema Migration and Full Data Migration.
Configure migration objects.
In the Available list, select the database objects that you want to migrate, such as databases, tables, or columns. Then, click the icon to add them to the Selected Objects list.
NoteBy default, the object names remain the same after the objects are migrated from an on-premises MySQL database to a self-managed MySQL database hosted on an ECS instance. If the name of a migrated object is different in the on-premises and destination databases, you must use the object name mapping feature provided by DTS. For more information, see Object name mapping.
Click Precheck.
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 the precheck succeeds, you can view the status and progress of the migration task in the Migration Tasks section.