Migrate data from ApsaraDB RDS to PolarDB-X 1.0

Updated at:
Copy as MD

This topic describes how to use the Import Evaluation feature of PolarDB-X 1.0 to migrate data from an ApsaraDB RDS instance to a PolarDB-X 1.0 instance.

Background

As your business grows, increasing data volumes, storage usage, concurrency, and queries per second (QPS) can cause performance bottlenecks on your ApsaraDB RDS instance. To address these challenges, you can migrate to PolarDB-X 1.0 to leverage database and table sharding. When migrating data from ApsaraDB RDS to PolarDB-X 1.0, consider the following questions:

  • What PolarDB-X 1.0 instance type should you choose?

  • What instance type should you choose for the underlying ApsaraDB RDS instances used by PolarDB-X 1.0?

  • After a table is migrated from ApsaraDB RDS to PolarDB-X 1.0, how do you shard it? How do you choose the number of shards and the shard key?

  • How can you quickly create the required databases and tables?

  • How can you quickly import data from ApsaraDB RDS to PolarDB-X 1.0?

Solution

To address these questions, PolarDB-X 1.0 provides the Import Evaluation feature, which helps you quickly migrate data from ApsaraDB RDS to a PolarDB-X 1.0 instance.

Table 1. Migration process

Step

Description

Step 1: Obtain evaluation suggestions

The evaluation suggestions feature of PolarDB-X 1.0 can:

  • Recommend an instance type for the destination PolarDB-X 1.0 instance and for the underlying ApsaraDB RDS instances.

  • Provide a sharding plan for each table in the source ApsaraDB RDS instance. This includes whether to shard a table, which column to use as the shard key, and the SQL statements to create tables when you import data into the PolarDB-X 1.0 instance.

Step 2: Import data

The PolarDB-X 1.0 data import feature supports the following methods:

  • Import based on evaluation suggestions: Provides an integrated migration solution that lets you quickly create databases and tables and import data based on the evaluation report.

    Figure 1. Task workflow任务执行流程

  • Custom import: You can purchase PolarDB-X 1.0 and ApsaraDB RDS instances, create databases and tables based on your business requirements, and then import data from the source ApsaraDB RDS database to the destination PolarDB-X 1.0 database.

    Figure 2. Task workflow任务执行流程

Step 3: Complete the migration

After the full data synchronization task is complete, PolarDB-X 1.0 provides incremental data synchronization for 14 days. After all data is imported, you can switch your business applications from ApsaraDB RDS to PolarDB-X 1.0.

Step 1: Obtain evaluation suggestions

PolarDB-X 1.0 can evaluate your source ApsaraDB RDS database and provide suggestions for migrating to the destination PolarDB-X 1.0 instance. The evaluation report contains all suggestions.

  1. Log on to the PolarDB-X 1.0 console.

  2. In the top navigation bar, select the region where the instance is deployed.

  3. In the navigation pane, choose Import Evaluation > Suggestions.

  4. In the upper-right corner of the Suggestions page, click Start ApsaraDB RDS Evaluation.

  5. On the Source Database Information page, set the following parameters.

    Parameter

    Description

    Task name

    Enter a name for the migration task.

    Source Database Information

    Instance type

    This parameter is fixed to ApsaraDB RDS Instance and cannot be changed.

    ApsaraDB RDS Instance ID

    Select the source ApsaraDB RDS instance.

    Database name

    Select the source database.

    Database port

    Enter the port of the source database.

    Database Account

    Enter the account for the source database.

    Database Password

    Enter the password for the source database account.

    Note

    After you enter the password, you can click Test Connection to verify connectivity to the source ApsaraDB RDS instance.

    Business Information

    For more accurate evaluation suggestions, set Expected Data Size Growth in Percentage and Expected Average QPS Growth in Percentage based on your business needs.

    Evaluation Duration

    You can set the evaluation duration to 1 hour, 3 hours, 6 hours, 1 day, 3 days, or 7 days. You can also specify a custom duration from 1 to 336 hours (14 days).

  6. Select Agree to Enable SQL Explorer and click Next.

  7. On the Task Precheck page, wait until the Precheck Result is Successful, and then click Start Task.

  8. After the evaluation task is complete, you can perform the following actions:

    • In the Actions column for the task, click Evaluation Report to view the evaluation suggestions.

      Note

      In the Recommended Sharding Result section, click Show to view sharding details, such as the sharding type and shard key. You can also click Export Table Creation SQL Statement to download the table creation SQL statements.

    • In the Actions column for the task, click Start Import to begin the data import.

Step 2: Import data

You can import data from the source ApsaraDB RDS instance to the destination PolarDB-X 1.0 instance in one of the following ways:

  • Import based on evaluation suggestions

    1. Log on to the PolarDB-X 1.0 console.

    2. In the upper-left corner, select the destination instance's region.

    3. In the navigation pane, choose Import Evaluation > Suggestions.

    4. Find the target task and click Start Import in the Actions column.

    5. On the Evaluation Summary page, confirm the recommended instance specifications and quantities, and then click Next.

    6. Select the destination PolarDB-X 1.0 instance, click the 图标 icon to move it to the selected list, and then click Next.

      Note

      You can select only one PolarDB-X 1.0 instance.

    7. Select the destination instances, click the 图标 icon to move them to the selected list, and then click Next.

      Note

      You can use existing ApsaraDB RDS instances. However, we recommend purchasing new ApsaraDB RDS instances to ensure dedicated storage resources for the destination PolarDB-X 1.0 instance.

    8. On the Task Precheck page, wait until the Precheck Result is Successful, and then click Next.

    9. On the Confirm Topology page, verify the source ApsaraDB RDS instance, source database, and destination PolarDB-X 1.0 instance, and then click Create Task.

  • Custom import

    1. Log on to the PolarDB-X 1.0 console.

    2. In the upper-left corner, select the destination instance's region.

    3. In the navigation pane, choose Import Evaluation > Import Data.

    4. In the upper-right corner of the Import Task page, click ApsaraDB RDS Custom Import.

    5. On the Source and Destination Databases page, set the following parameters, and then click Next.

      Parameter

      Description

      Task name

      Enter a name for the migration task.

      Source Database Information

      Instance type

      This parameter is fixed to ApsaraDB RDS Instance and cannot be changed.

      ApsaraDB RDS Instance ID

      Select the source ApsaraDB RDS instance.

      Database name

      Select the source database.

      Database port

      Enter the port of the source database.

      Database account

      Enter the account for the source database.

      Database Password

      Enter the password for the source database account.

      Note

      After you enter the password, you can click Test Connection to verify connectivity to the source ApsaraDB RDS instance.

      Destination Database Information

      Database port

      Enter the port of the destination database.

      Database account

      Enter the account for the destination database.

      Database Password

      Enter the password for the destination database account.

      Note

      After you enter the password, you can click Test Connection to verify connectivity to the destination PolarDB-X 1.0 instance.

    6. On the Migration Task page, select the tables to migrate from the Source Table Name list on the left. For each source table, select its corresponding destination table from the Destination Table Name list on the right. Then, click Next.

      Important

      You cannot migrate tables that use a composite primary key. If you try to migrate such a table, the Task Precheck fails.

    7. On the Task Precheck page, wait until the Precheck Result is Successful, and then click Start Task.

Step 3: Complete the migration

  1. Log on to the PolarDB-X 1.0 console.

  2. In the top navigation bar, select the region where the instance is deployed.

  3. In the navigation pane, choose Import Evaluation > Import Data.

  4. Find the target task and click End Task in the Actions column.

    Note
    • PolarDB-X 1.0 provides an incremental data synchronization service for 14 days after a full data synchronization task is complete. After the Task Progress reaches 100%, you can click End Task to manually complete the migration. You can also wait for the system to automatically End Task after the 14-day incremental data synchronization service stops.

    • After you click End Task, the data import task's Task Status changes from Running to Completed. You can then click Clear Task to remove it from the task list.

FAQ

Q: Do I need to stop write operations on the source database before starting the data import?

No, you do not need to. PolarDB-X 1.0 guarantees 14 days of incremental data synchronization after the full data synchronization task is complete. After the Task Progress shows 100%, you can click End Task to manually complete the migration. Alternatively, you can wait for the system to automatically End Task after the 14-day incremental data synchronization service stops.