This topic describes how to migrate data from a Microsoft Azure Database for MySQL instance to an ApsaraDB RDS for MySQL instance. This topic also provides the usage notes of data migration.
Prerequisites
Source and destination | Requirement | References | |
Source |
| ||
Destination | ApsaraDB RDS for MySQL instance |
| |
Usage notes
The schema migration method does not support events.
DTS uses read and write resources of the source and destination databases during full data migration. This may increase the loads of the database servers. If the database performance is unfavorable, the specification is low, or the data volume is large, database services may become unavailable. For example, DTS occupies a large amount of read and write resources in the following cases: a large number of slow SQL queries are performed on the source database, the tables have no primary keys, or a deadlock occurs in the destination database. Before you migrate data, evaluate the impact of data migration on the performance of the source and destination databases. We recommend that you migrate data during off-peak hours. For example, you can migrate data when the CPU utilization of the source and destination databases is less than 30%.
The tables to be migrated in the source database must have PRIMARY KEY or UNIQUE constraints and all fields must be unique. Otherwise, the destination database may contain duplicate data records.
DTS uses the
ROUND(COLUMN,PRECISION)function to retrieve values from columns of the FLOAT or DOUBLE data type. If you do not specify a precision, DTS sets the precision for the FLOAT data type to 38 digits and the precision for the DOUBLE data type to 308 digits. You must check whether the precision settings meet your business requirements.DTS automatically creates a destination database in the ApsaraDB RDS for MySQL instance. However, if the name of the source database is invalid, you must manually create a database in the ApsaraDB RDS for MySQL instance before you configure the data migration task.
NoteFor more information about the database naming conventions of ApsaraDB RDS for MySQL databases and how to create a database, see Manage databases.
If a data migration task fails, DTS automatically resumes the task. Before you switch your workloads to the destination instance, stop or release the data migration task. Otherwise, the data in the source database overwrites the data in the destination instance after the task is resumed.
DTS attempts to resume the data migration task that failed within the previous seven days. Before you switch workloads over to the destination instance, you must stop or release the failed tasks. Alternatively, you can execute the
REVOKEstatement to revoke the write permissions of the DTS account that is used to access the destination instance. If the write permissions of the DTS account are not revoked, data in the source instance overwrites the data in the destination instance after the data migration task is resumed.If you enable the object name mapping feature for an object, other objects that are dependent on the object may fail to be migrated.
To ensure compatibility, the versions of MySQL on the source and destination instances must be the same.
DTS automatically creates a destination database in the ApsaraDB RDS for MySQL instance. However, if the name of the source database is invalid, you must manually create a database in the ApsaraDB RDS for MySQL instance before you configure the data migration task.
For more information about the database naming conventions of ApsaraDB RDS for MySQL databases and how to create a database, see Manage databases.
Billing rules
Migration type | Task configuration fee | Internet traffic fee |
Schema migration and full data migration | Free of charge. | Charged only when data is migrated from Alibaba Cloud over the Internet. For more information, see Billing overview. |
Incremental data migration | Charged. For more information, see Billing overview. |
Procedure
Go to the Data Migration Tasks page for the required region.
Log on to the DTS console.
In the left-side navigation pane, click Data Migration.
In the top navigation bar, select the required region.
Click Create Task to go to the task configuration page.
Configure the source and destination databases. The following table describes the parameters.
Section
Parameter
Description
Source instance
Database Type
The type of the source instance. In this example, MySQL is selected.
Access Method
The method that is used by the source instance to access DTS. In this example, Public IP Address is selected.
Instance Region
The region of the source instance. If you set the Access Method parameter to Public IP Address, you can select a region based on your business requirements. In this example, China (Hangzhou) is selected.
If you configured access control policies for the instance, you must authorize DTS to access the instance before you configure a migration task. For more information about the CIDR blocks of DTS servers, see Add the CIDR blocks of DTS servers.
Domain Name or IP
The name of the server that hosts the source instance.
Port Number
The port number of the source instance. The port must be accessible over the Internet. Default value: 3306.
Database Account
The username of the privileged account of the source instance.
Database Password
The password of the privileged account of the source instance.
Destination instance
Database Type
The type of the destination instance. In this example, MySQL is selected.
Access Method
The method that is used by the destination instance to access DTS. In this example, Alibaba Cloud Instance is selected.
Instance Region
The region of the destination instance.
Replicate Data Across Alibaba Cloud Accounts
Specifies whether to replicate data across Alibaba Cloud accounts. In the example, No is selected.
RDS Instance ID
The ID of the destination instance in the specified region.
Database Account
The username of the privileged account of the destination instance.
Database Password
The password of the privileged account of the destination instance.
Encryption
Specifies whether to use encrypted connections. Valid values: Non-encrypted and SSL-encrypted. If you set this parameter to SSL-encrypted, CPU utilization of the RDS instance is significantly increased.
Click Test Connectivity and Proceed at the bottom of the page.
Add the CIDR block of the DTS server to the IP address whitelist of the source instance. Then, click Test Connectivity.
ImportantAfter you add the CIDR block of the DTS server to the IP address whitelist, security risks may arise. 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 security settings, and forbidding unauthorized CIDR blocks.
In the Configure Task Objects and Advanced Configurations step, configure the Migration Types parameter.
NoteTo ensure data consistency, we recommend that you select Schema Migration, Full Data Migration, and Incremental Data Migration.
In the Source Objects section, select the database that you want to migrate and click the
icon to move the selected database to the Selected Objects section. Click Next: Advanced Settings. On the page that appears, retain the default parameter settings.
Click Next: Save Task Settings and Precheck. Wait until the precheck is complete.
NoteIf the precheck fails, you can resolve the issues based on the instructions and then rerun the precheck.
Click Next: Purchase Instance. On the page that appears, read and select Data Transmission Service (Pay-as-you-go) Service Terms and click Buy and Start.