You can migrate databases from ECS to ApsaraDB for RDS High-availability Edition to
ensure high availability, reliability, security, and convenience of database services.
This topic uses a MySQL database as an example to describe how to use DTS to migrate
a user-created database from an ECS instance to an RDS instance.
Prerequisites
- An SLB instance is configured. For more information, see Configure an SLB instance.
- An RDS High-availability Edition instance is created. For more information about how
to create an RDS instance, see Create an ApsaraDB RDS for MySQL instance.
- You have created an account for the RDS instance. For more information, see Create databases and accounts for an ApsaraDB RDS MySQL instance.
- You have created an account other than root for the user-created database on the ECS
instance. The account is used for data migration over Data Transmission Service (DTS).
You can run the following command to create an account with its username as dts and
password as 123456 for the MySQL database:
grant all on *.* to 'dts'@'%' IDENTIFIED BY '123456';
Background information
DTS allows you to migrate data between heterogeneous and homogeneous data sources.
It also provides multiple ETL features such as three-level object mapping (for databases,
tables, and columns) and data filtering. You can use DTS for zero-downtime migration.
During the migration process, the source database continues to provide services, minimizing
the impact of migration on your business. For information about the databases supported
by DTS, see Data migration.
Procedure
- Log on to the DTS console.
- In the left-side navigation pane, select Data Migration.
- Select the region where the RDS instance is located, and click Create Migration Task.
- Configure the migration task.
- Specify a task name.
You can use the default name or specify one.
- Configure the source database.
DTS supports user-created databases that are accessible through the Internet, VPN
Gateway, an Express Connect circuit, or Smart Access Gateway. The source database
used in this topic is a user-created database in an ECS instance. For migration solutions
for other types of databases, see
DTS documentation.
Parameter |
Description |
Instance Type |
The user-created database in an ECS instance. |
Instance Region |
The region where the source ECS instance is located. |
ECS Instance ID |
The ID of the ECS instance. DTS supports ECS instances of the classic network and
VPC types.
|
Database Type |
The type of the user-created database in the source ECS instance. The database type
is MySQL in this example.
|
Port Number |
The listening port number for the MySQL database. |
Database Account |
The account other than root to access the MySQL database in the source ECS instance.
Note The account here must be an account other than root. Otherwise, an error occurs when
you test connectivity.
|
Database Password |
The password for the account other than root. |
- Click Test Connectivity in the lower-right corner of the Source Database section.
If Test Passed is returned, it indicates that the connection to the source database is normal.
- Configure information of the destination database.
Parameter |
Description |
Instance Type |
The type of the 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 about how to create an account
for an RDS instance, see Create databases and accounts for an ApsaraDB RDS MySQL instance.
Note The account here must be an account other than root. Otherwise, an error occurs when
you test connectivity.
|
Database Password |
The password of the account to access the database. |
- Click Test Connectivity in the lower-right corner of the Destination Database section.
If Test Passed is returned, it indicates that the connection to the source database is normal.
- 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 both 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 > to add them to the Selected list.
Note
By default, the object names remain the same as those in the local MySQL database
after objects are migrated to a user-created MySQL database in an ECS instance. If
an object that you migrate has different names in the source and destination instances,
you need to use the object name mapping feature provided by DTS. For more information,
see Mappings of database, table, and column names.
- Click Precheck.
Before the migration task starts, DTS checks items such as connectivity, permissions,
and log formats.
If the precheck is successful, you can see 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 the application
to remotely connect to the RDS instance. You can also use Data Management (DMS) or
the client to manage the RDS instance. For more information, see Connect to an RDS MySQL instance.