This topic describes how to use the evaluation and import feature of PolarDB-X 1.0 to migrate data from an ApsaraDB RDS instance to a PolarDB-X 1.0 instance.
Issues to consider
As business growth drives the expansion of data volumes and the increase in storage usage, concurrent activities, and queries per second (QPS) on an ApsaraDB RDS instance, the instance may experience performance bottlenecks. In this case, you can migrate data from the ApsaraDB RDS instance to a PolarDB-X 1.0 instance to leverage database and table sharding for improved performance and scalability. To migrate data from an ApsaraDB RDS instance to a PolarDB-X 1.0 instance, you may need to consider the following issues:
How do you select the PolarDB-X 1.0 instance type?
How do you select the specifications of the ApsaraDB RDS instance whose data is imported to the PolarDB-X 1.0 instance?
How do you shard a regular table that is migrated from the ApsaraDB RDS instance to the PolarDB-X 1.0 instance? How do you determine the number of shards and the shard keys?
How do you quickly create databases and tables?
How do you quickly import data from the ApsaraDB RDS instance to the PolarDB-X 1.0 instance?
Solution
PolarDB-X 1.0 provides the evaluation and import feature to help you efficiently migrate data from an ApsaraDB RDS instance to a PolarDB-X 1.0 instance.
Table 1. Migration process
Step | Description |
The PolarDB-X 1.0 evaluation suggestions include the following aspects:
| |
PolarDB-X 1.0 allows you to import data in the following ways:
| |
PolarDB-X 1.0 performs incremental data synchronization for 14 days after the full data synchronization task is completed. After all data is imported, you can switch your business from the ApsaraDB RDS instance to the PolarDB-X 1.0 instance. |
Step 1: Obtain evaluation suggestions
PolarDB-X 1.0 can evaluate the source RDS instance and provide suggestions for migration to the destination PolarDB-X 1.0 instance. All suggestions are displayed in the evaluation report.
Log on to the PolarDB-X 1.0 console.
In the top navigation bar, select the region where the instance is deployed.
In the left-side navigation pane, choose .
In the upper-right corner of the Suggestions page, click Start ApsaraDB RDS Evaluation.
On the Source Database Information page, configure the parameters. The following table describes the parameters.
Parameter
Description
Parameter
Description
Task Name
Specify the name of the migration task.
Source Database Information
Instance Type
The parameter is automatically set to ApsaraDB RDS Instance. You do not need to specify this parameter.
ApsaraDB RDS Instance ID
Select the source ApsaraDB RDS instance.
Database Name
Select the source database.
Database Port
Enter the port number of the source database.
Database Account
Enter the account of the source database.
Database Password
Enter the password of the source database account.
After you enter the account and password of the source database, click Test Connection on the right to check whether the source ApsaraDB RDS instance can be connected.
Business Information
You can configure the Expected Data Size Growth in Percentage and Expected Average QPS Growth in Percentage parameters based on your business requirements to obtain more accurate evaluation suggestions.
Evaluation Duration
You can set the Evaluation Duration parameter to 1 hour, 3 hours, 6 hours, 1 day, 3 days, or 7 days. You can also specify a custom evaluation duration from 1 to 336 hours (14 days).
Select Agree to Enable SQL Explorer and click Next.
On the Task Precheck page, click Start Task when the precheck result displays Successful.
After the evaluation task is completed, perform the following steps:
Click Evaluation Report in the Actions column corresponding to the task to view the evaluation details.
You can click Show in the Recommended Sharding Result section to view the details of sharding, such as the sharding type and shard key. You can also click Export Table Creation SQL Statement to download the SQL statements that are used to create tables.
You can click Start Import in the Actions column to import data.
Step 2: Import data
You can use one of the following methods to import data from the source ApsaraDB RDS instance to the destination PolarDB-X 1.0 instance:
Evaluation-based import
Log on to the PolarDB-X 1.0 console.
In the top navigation bar, select the region in which the destination PolarDB-X 1.0 instance is deployed.
In the left-side navigation pane, choose
.Find the task and click Start Import in the Actions column.
On the Evaluation Summary page, confirm the type and number of the recommended instances, and then click Next.
Select the destination PolarDB-X 1.0 instance and click the
icon to add the instance to the selected section on the right, and then click Next.
You can select only one destination PolarDB-X 1.0 instance.
Select the source ApsaraDB RDS instance, click the
icon to add the instance to the selected section on the right, and then click Next.
You can continue to use the purchased ApsaraDB RDS instance. However, we recommend that you purchase a new ApsaraDB RDS instance as a separate storage resource for the PolarDB-X 1.0 instance.
On the Task Precheck page, click Next when the precheck result displays Successful.
On the Confirm Topology page, confirm the source ApsaraDB RDS instance, source database, and destination PolarDB-X 1.0 instance, and click Create Task.
Custom import
Log on to the PolarDB-X 1.0 console.
In the top navigation bar, select the region in which the destination PolarDB-X 1.0 instance is deployed.
In the left-side navigation pane, choose
.In the upper-right corner of the Import Task page, click ApsaraDB RDS Custom Import.
On the Source and Destination Database page, configure the parameters and click Next. The following table describes the parameters.
Parameter
Description
Parameter
Description
Task Name
Specify the name of the migration task.
Source Database Information
Instance Type
The parameter is automatically set to ApsaraDB RDS Instance. You do not need to specify this parameter.
ApsaraDB RDS Instance ID
Select the source ApsaraDB RDS instance.
Database Name
Select the source database.
Database Port
Enter the port number of the source database.
Database Account
Enter the account of the source database.
Database Password
Enter the password of the source database account.
After you enter the account and password of the source database, click Test Connection to check whether the source ApsaraDB RDS instance can be connected.
Destination Database Information
Database Port
Enter the port number of the destination database.
Database Account
Enter the account of the destination database.
Database Password
Enter the password of the destination database account.
After you enter the account and password of the destination database, click Test Connection to check whether the destination PolarDB-X 1.0 instance can be connected.
On the Migration Task page, select the source table from the Source Table Name column on the left, select the destination table from the Destination Table Name column on the right, and then click Next.
You cannot migrate tables that use a composite primary key. If you migrate such tables, an error occurs in the Task Precheck step.
On the Task Precheck page, click Start Task when the precheck result displays Successful.
Step 3: Complete the migration
Log on to the PolarDB-X 1.0 console.
In the top navigation bar, select the region where the instance is deployed.
In the left-side navigation pane, choose .
Find the task and click End Task in the Actions column.
PolarDB-X 1.0 performs incremental data synchronization for 14 days after the full data synchronization task is completed. When the task progress Task Progress is displayed as 100%, you can click End Task to manually complete the migration. You can also wait for the system to automatically end the task after the 14-day incremental data synchronization expires.
When the task status is changed from Running to Completed, you can click Clear Task to clear the task. A cleared task is not displayed in the task list.
FAQ
Do I need to suspend write operations on the source database before I start to import data?
No, PolarDB-X 1.0 performs incremental data synchronization for 14 days after the full data synchronization task is completed. After the progress bar in the Task Progress column is displayed as 100%, you can click End Task to manually complete the migration. You can also wait for the system to automatically end the task after the 14-day incremental data synchronization expires.