You can migrate databases from Elastic Compute Service (ECS) instances to ApsaraDB
RDS instances that run RDS High-availability Edition to ensure high availability,
reliability, security, and convenience of database services. This topic describes
how to migrate a self-managed database on an ECS instance to an ApsaraDB RDS instance
that runs RDS High-availability Edition by using Data Transmission Service (DTS).
In this topic, a MySQL database is used.
Prerequisites
- A Server Load Balancer (SLB) instance is configured. For more information, see Configure an SLB instance.
- An ApsaraDB RDS instance that runs RDS High-availability Edition is created and uses
the multi-zone deployment method. For more information about how to create an ApsaraDB
RDS instance, see Create an ApsaraDB RDS for MySQL instance.
- An account is created for the RDS instance. For more information, see Create databases and accounts for an ApsaraDB RDS for MySQL instance.
- A non-root account is created for the self-managed database hosted on the ECS instance.
The account is used for data migration by using Data Transmission Service (DTS).
For example, you can run the following command to create an account with its username
as dts and password as 123456 for a MySQL database:
grant all on *.* to 'dts'@'%' IDENTIFIED BY '123456';
Background information
DTS supports data migration between homogeneous and heterogeneous data sources. It
also supports ETL features such as data mapping at three levels (databases, tables,
and columns) and data filtering. You can use DTS for zero-downtime data migration.
During data migration, the source database continues to provide services normally,
minimizing the impact of data migration on your business. For more 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 RDS instance is located, and click Create Migration Task.
- Configure a migration task.
- Configure a task name.
You can use the default name or customize a name.
- Configure the source database.
DTS supports self-managed databases connected over the Internet, VPN Gateway, Express
Connect, or Smart Access Gateway. In this topic, the source database is a self-managed
database on an ECS instance. For information about migration solutions for other database
types, see
What is DTS?
Parameter |
Description |
Instance Type |
A self-managed database that is hosted on an ECS instance. |
Instance Region |
The region where the source ECS instance is located. |
ECS Instance ID |
The ID of the source ECS instance. DTS supports ECS instances in the classic network
and virtual private clouds (VPCs).
|
Database Type |
The type of the self-managed database hosted on the source ECS instance. In this example,
the database type is MySQL.
|
Port Number |
The listening port number for the MySQL database. |
Database Account |
The non-root account to access the MySQL database hosted on the source ECS instance.
Note The account cannot be the root account. Otherwise, an error occurs when you test connectivity.
|
Database Password |
The password of the account. |
- Click Test Connectivity in the lower-right corner of the Source Database section.
If Test Passed is returned, the source database can be connected.
- Configure the destination database.
Parameter |
Description |
Instance Type |
An ApsaraDB RDS instance. |
Instance Region |
The region where the RDS instance is located. |
RDS Instance ID |
The ID of the RDS instance. |
Database Account |
The account of the RDS instance. For more information, see Create databases and accounts for an ApsaraDB RDS for MySQL instance.
Note The account cannot be the root account. Otherwise, an error occurs when you test connectivity.
|
Database Password |
The password of the account. |
- Click Test Connectivity in the lower-right corner of the Destination Database section.
If Test Passed is returned, the destination database can be connected.
- Click Set Whitelist and Next.
- Configure migration types and objects.
- Configure migration types.
- To perform zero-downtime data migration, select Schema Migration, Full Data Migration,
and Incremental Data Migration.
- To perform full data migration, select Schema Migration and Full Data Migration.
- Configure migration objects.
In the Available list, select the database objects to be migrated, such as databases, tables, or columns.
Then, click the > icon to add them to the Selected list.
Note
By default, the object names remain the same as those in the on-premises MySQL database
after objects are migrated to a self-managed MySQL database hosted on an ECS instance.
If a migration object has different names in the source and destination instances,
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.
If the task passes the precheck, you can view the status and progress of the migration
task in the
Migration Tasks section.

What to do next
Configure the endpoint, account, and password of the RDS instance in applications
to connect to the RDS instance. You can use Data Management (DMS) or the MySQL client
to manage the RDS instance. For more information, see Use a database client or the CLI to connect to an ApsaraDB RDS for MySQL instance.