Use Data Transmission Service (DTS) to migrate data from MaxCompute to ApsaraDB RDS for MySQL.
Prerequisites
Complete the following prerequisites:
Precautions
-
During a full data migration, DTS consumes read and write resources on the source and destination databases, increasing their load. If your databases have poor performance, low specifications, or high workloads (for example, if the source database has many slow SQL queries or tables without primary keys, or if deadlocks occur in the destination database), the increased load can strain your databases or even cause service interruptions. Perform the data migration during off-peak hours, such as when the CPU utilization of both databases is below 30%.
-
DTS automatically creates a database in the destination instance. However, if the source database name does not comply with ApsaraDB RDS for MySQL naming conventions, you must create a compatible database in the destination instance before you configure the task.
NoteFor naming conventions and creation instructions, see (Deprecated. Redirects to "Step 1") Create a database and an account.
-
To ensure data consistency during a full data migration, do not write new data to the source MaxCompute instance.
-
DTS automatically recovers failed migration tasks. Before you switch workloads to the destination instance, you must stop or release the task. Otherwise, a recovered task might overwrite data in the destination instance with data from the source.
-
Because the source MaxCompute instance does not support primary key constraints, DTS may retry a task under certain exceptions, such as network instability. This can lead to duplicate data in tables that do not have primary keys in the destination ApsaraDB RDS for MySQL instance.
-
DTS does not support incremental data migration from MaxCompute to ApsaraDB RDS for MySQL.
NoteBecause incremental migration is unsupported for this scenario, do not write new data to the source objects during migration to avoid data inconsistencies.
Supported destination types
The following MySQL instance types are supported as the destination:
-
A self-managed database hosted on an ECS instance
-
A self-managed database connected over Express Connect, VPN Gateway, or Smart Access Gateway
-
A self-managed database connected over Database Gateway
-
An ApsaraDB RDS for MySQL instance that belongs to the same or a different Alibaba Cloud account
This topic uses an RDS Instance as an example. The process for other destination types is similar.
If the destination is a self-managed MySQL database, you must also complete some preparations. For more information, see Overview of preparations.
Billing
|
Migration type |
Link configuration fee |
Public traffic fee |
|
schema migration and full data migration |
Free of charge |
You are charged for traffic if data is migrated out of Alibaba Cloud over the public network. For more information, see Billing overview. |
Migration types
|
Migration type |
Description |
|
schema migration |
DTS migrates the schema definitions of the selected objects to the destination database. DTS supports schema migration for databases, tables, and views. Warning
This scenario involves data migration between heterogeneous databases, where data types may not map perfectly during schema migration. Carefully evaluate the impact of data type mappings on your business. For more information, see Data type mappings for heterogeneous databases. |
|
full data migration |
DTS migrates all existing data of the selected objects to the destination database. Note
Full data migration uses concurrent INSERT operations, which can cause table fragmentation in the destination instance. After the migration is complete, the tablespace in the destination database may be larger than in the source database. |
Procedure
-
Log on to the DTS console.
NoteIf you are automatically redirected to the Data Management (DMS) console, you can click the
icon in the lower-right corner and then click
to return to the classic DTS console. -
In the left-side navigation pane, click Data Migration.
-
At the top of the Migration Tasks page, select the region of the destination cluster.
-
Configure the connection information for the source and destination databases.
Section
Parameter
Description
Source Database
Instance Type
Select MaxCompute.
Region
Select the region where the source MaxCompute instance is located.
Project
Enter the name of the MaxCompute Project. You can find the project name on the MaxCompute Workspaces page.
Destination Database
Instance Type
Select RDS Instance.
Region
Select the region where the destination ApsaraDB RDS for MySQL instance is located.
RDS Instance ID
Select the ID of the destination ApsaraDB RDS for MySQL instance.
Database Account
Enter the database account for the destination ApsaraDB RDS for MySQL instance. The account must have read and write permissions.
Database Password
Enter the password for the database account.
After you enter the destination database information, you can click Test Connectivity next to Database Password to verify that the entered information is correct.
NoteIf the settings are correct, a Passed message appears. If a Failed message appears, click Diagnose next to Failed and follow the guidance to adjust the destination database information.
Connection Method
Select Non-encrypted or SSL-encrypted as needed. If you select SSL-encrypted, you must enable SSL encryption for the ApsaraDB RDS for MySQL instance in advance. For more information, see Set SSL encryption.
-
Click Whitelist Settings and Next.
If the source or destination database is an Alibaba Cloud database instance, such as ApsaraDB for MySQL or ApsaraDB for MongoDB, DTS automatically adds the IP addresses of the DTS service in the corresponding region to the whitelist of the Alibaba Cloud database instance. If the source or destination database is a self-managed database on an ECS instance, DTS automatically adds the IP addresses of the DTS service in the corresponding region to the security rules of the ECS instance. You must also ensure that the self-managed database does not restrict access from the ECS instance. If the database is deployed in a cluster on multiple ECS instances, you must manually add the IP addresses of the DTS service in the corresponding region to the security rules of each of the other ECS instances. If the source or destination database is a self-managed database in an on-premises data center (IDC) or a database from another cloud service provider, you must manually add the IP addresses of the DTS service in the corresponding region to allow access from the DTS servers. For the IP addresses of the DTS service, see IP address blocks of DTS servers.
WarningAdding the public CIDR blocks of DTS servers, whether automatically or manually, may introduce security risks. By using this product, you acknowledge and accept these potential risks. You are responsible for implementing basic security measures, including but not limited to using strong passwords, restricting open ports, using authentication for internal API calls, regularly reviewing and restricting unnecessary network segments, or connecting through private networks such as Express Connect, VPN Gateway, or Smart Access Gateway.
-
Click Next to grant the required permissions to the DTS migration account for the MaxCompute project.
The required permissions are CreateTable, CreateInstance, CreateResource, CreateJob, and List.
-
Select the migration types and objects.
For the Case-sensitive Names in Destination Database policy, you can select Default DTS Policy, Same as Source, Same as Destination Default (Uppercase), or Same as Destination Default (Lowercase).
Parameter
Description
Migration Types
Select both Schema Migration and Full Data Migration.
NoteDTS does not support incremental data migration from MaxCompute to an ApsaraDB RDS for MySQL instance.
Migration Objects
In the Available box, click an object that you want to migrate, and then click the
icon to move it to the Selected Objects box.Note-
You can select objects at the database, table, or column level.
-
By default, the names of migrated objects in the destination database remain the same as in the source database. If you want to change the names in the destination database, use the object name mapping feature. For more information, see Map objects.
-
If you use object name mapping, the migration of other objects that depend on the mapped object may fail.
Retry Duration for Network Disconnections
The default retry duration is 12 hours. You can also specify a custom duration. If DTS reconnects to the source or destination database within the specified duration, the migration task automatically resumes. Otherwise, the task fails.
NoteDTS charges for task runtime during connection retries. We recommend that you set a retry duration based on your business needs, or release the DTS instance as soon as you release the source and destination instances.
-
-
Click Precheck and Start.
Important-
Before the task starts, DTS performs a precheck. You can only start the task after it passes this precheck.
-
If the precheck fails, click the
icon next to a specific check item to view failure details.-
You can fix the issues based on the details and then run the precheck again.
-
If you do not need to fix the warning items, you can select Ignore or Ignore and Precheck Again to skip the warning items and run the precheck again.
-
-
-
After the task passes the precheck, click Next.
-
In the Confirm Settings dialog box that appears, select a Instance Class and select the Data Transmission Service (pay-as-you-go) Service Terms checkbox.
-
Click Buy and Start to start the migration task.
NoteDo not manually stop the migration task, as this may result in incomplete data. Wait for the task to stop automatically upon completion.
-
Switch your workloads to the ApsaraDB RDS for MySQL instance.
What to do next
The permissions granted for migration pose a security risk if left active. To improve security after migration, remove or modify member roles in the source MaxCompute project and delete the temporary account from the destination instance. For more information, see Add project members and configure their roles and Delete an account.