This topic describes how to use the evaluation import feature of DRDS to migrate data from ApsaraDB for RDS (RDS) to Distributed Relational Database Service (DRDS).

Background

When you use the RDS service, the data volume, storage, concurrency, and queries per second (QPS) are increased along with the business growth. This may cause performance bottlenecks. You can migrate data from RDS to DRDS for database sharding and table sharding. You may need to fix the following issues during the data migration from RDS to DRDS:

  • How do I select the DRDS instance type?
  • How do I select the type of RDS instance that is attached to the DRDS instance?
  • How do I shard a RDS table after the table is migrated to DRDS? How do I determine the number of shards and the shard keys?
  • How can I create databases and tables?
  • How can I quickly import data from RDS to DRDS?

Solutions

To fix these issues, DRDS provides the evaluation import feature.DRDS allows you to simplify data migration from RDS to DRDS.

Table 1. Procedure
Step Description
Step 1: Obtain evaluation suggestions

DRDS provides the following evaluation suggestions:

  • Recommends the types of the DRDS instance and its attached ApsaraDB RDS for MySQL instances.
  • Provides sharding solutions for each table in the source RDS. For example, you can check whether to shard each table of the source database, determine the column that is used as the shard key. DRDS also suggests the statements that are used to create tables and import data to DRDS.
Step 2: Import data

You can use the data import feature provided by DRDS in the following ways:

  • Evaluation-based import: Based on the evaluation and recommendations, an integrated migration solution is provided to create databases, create tables, and import data.
    Figure 1. Task flow
    Task flow
  • Custom import: You can purchase DRDS and ApsaraDB RDS for MySQL instances based on your business requirements, and create databases and tables. Then, import data from the source RDS database to the destination DRDS database.
    Figure 2. Task flow
    Task flow
Step 3: Complete the data migration After all data is migrated, DRDS provides a 14-day synchronization service for incremental data. After all data is imported, you can switch your service from RDS to DRDS.

Step 1: Obtain evaluation suggestions

DRDS evaluates the source RDS and provides suggestions on data migration to DRDS. All suggestions are included in the evaluation report.

  1. Log on to the DRDS console.
  2. In the top navigation bar, select the region where the target instance is located.
  3. In the left-side navigation pane, choose Evaluation import > Suggestions.
  4. In the upper-right corner of the Suggestions page, click Start RDS assessment.
    Start RDS assessment
  5. On the SOURCE database information page, set the following parameters.
    Parameter Description
    Task name The name of a data migration task.
    Source Database Information Instance type Use the default value of RDS instance.
    RDS instance ID Select the source 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.
    Note After you enter the account and password of the source database, click Test connection to check whether the source RDS can be connected.
    Business Information You can set the Expected data scale growth percentage and Expected average QPS growth percentage to proper values based on your business requirements to obtain more accurate assessment suggestions.
    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 enter a custom evaluation duration from 1 to 336 hours (14 days).
  6. Select Agree to open SQL insight and click Next.
  7. On the Task preview page, click Start task when the Precheck Result displays Success.
  8. After the assessment task is completed, perform the following steps:
    Assessment is completed
    • You can click Assessment Report in the Operation column to view evaluation details.Report
      Note You can click Show in the Split Recommendation section to view details of sharding, such as the sharding type and shard key. You can also click Export and create table SQL to download the SQL statements that are used to create tables.
    • You can click Start Import in the Operation column to import data.

Step 2: Import data

You can import data from the source RDS to DRDS in the following ways:

  • Evaluation-based import:
    1. Log on to the DRDS console.
    2. In the top menu bar, select the region where the destination instance is deployed.
    3. In the left-side navigation pane, choose Evaluation import > Suggestions.
    4. On the page that appears, find the task and click Start Import in the Operation column.Import data
    5. On the Assessment Summary page, confirm the recommended instance type and number, and click Next.
    6. Select the DRDS instance, click Add icon to add the instance to the selected section on the right, and then click Next.
      Note You can select only one DRDS instance.
    7. Select the RDS instance, click Add icon to add the instance to the selected section on the right, and then click Next.
      Note You can continue to use the purchased ApsaraDB RDS for MySQL instance. However, we recommend that you purchase a new ApsaraDB RDS for MySQL instance as a separate storage resource for DRDS.
    8. On the Task preview page, click Next when the Precheck Result displays Success.
    9. On the Topology confirmation page, confirm the source RDS instance, source database, and the destination DRDS instance, and click Create task.
  • Custom import
    1. Log on to the DRDS console.
    2. In the top menu bar, select the region where the destination instance is deployed.
    3. In the left-side navigation pane, choose Evaluation import > Data import.
    4. In the upper-right corner of the Import tasks page, click RDS custom import.
    5. On the Source database and target database page, configure the following parameters and click Next.
      Parameter Description
      Task name The name of a data migration task.
      Source Database Information Instance type Use the default value of RDS instance.
      RDS instance ID Select the source 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.
      Note After you enter the account and password of the source database, click Test connection to check whether the source RDS can be connected.
      Target 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.
      Note After you enter the account and password of the destination database, click Test connection to check whether the destination DRDS can be connected.
    6. On the Migration list page, select the source table from the SOURCE table name column on the left, select the destination table from Target table name on the right, and then click Next.
      Notice Tables that use a composite primary key cannot be migrated. Otherwise, an error occurs in the Task preview step.
    7. On the Task preview page, click Start task when the Precheck Result displays Success.

Step 3: Complete the data migration

  1. Log on to the DRDS console.
  2. In the top navigation bar, select the region where the target instance is located.
  3. In the left-side navigation pane, choose Evaluation import > Data import.
  4. On the page that appears, find the destination table and click End Task in the Operation column.
    Complete the task
    Note
    • After the full data is migrated, DRDS provides a 14-day synchronization service for incremental data. After the Task progress is changed to 100%, you can click End Task to complete data migration. You can also wait until the system stops 14-day synchronization for incremental data and automatically End Task.
    • The Task Status of the data import is changed from Running to Ended after End Task. You can click Cleanup Tasks to delete the task. Deleted tasks are not displayed in the task list.

FAQ

Q: Do I need to stop excuting writing data to the source database before data importing?

A: No. After the full data is migrated, DRDS provides a 14-day synchronization service for incremental data. After the Task progress is changed to 100%, you can click End Task to complete data migration. You can also wait until the system stops 14-day synchronization for incremental data and automatically End Task.