This topic describes how to migrate MySQL data from AWS RDS to Alibaba Cloud RDS.

Background information

This topic describes how to use Alibaba Cloud DTS to migrate MySQL data from AWS RDS to Alibaba Cloud RDS.

Prerequisites

Restrictions

  • Schema migration does not support the migration of events.
  • DTS reads floating-point values (including float values and double values) in a column of the MySQL database by using the round(column,precision) method. If the value precision is not specified, the precision is 38 for float values and 308 for double values. Therefore, you must check whether the migration precision meets your service expectations.
  • If object name mapping is enabled for an object, other objects depending on this object may fail to be migrated.
  • If Incremental Data Migration is selected, binary logging must be enabled for the source MySQL instance.
  • If Incremental Data Migration is selected, the binlog_format parameter of the source database must be set to row.
  • If Incremental Data Migration is selected and the source MySQL version is 5.6 or later, the binlog_row_image parameter must be set to full.
  • If binlog file ID disorder occurs in the source MySQL instance because of cross-host migration or reconstruction during incremental data migration, the incremental data being migrated may be lost.

Precautions

  • We recommend that you back up data before performing migration tasks.

  • DTS attempts to automatically recover abnormal tasks within seven days, which may lead to data in the source database overwriting the service data that has been written to the target database. Therefore, you must revoke the write permission of the DTS account that is used to access the target instance by running the revoke command.

Procedure

  1. Log on to the AWS MySQL database instance, and click Database Name. On the Connection page, view Endpoint and Port.


  2. Log on to the DTS console.
  3. In the left-side navigation pane, click Data Migration. In the right pane, click Create Migration Task in the upper-right corner.
  4. Optional. Create a name for the task.

    DTS generates a name for each task automatically. The task name is not required to be unique. You can modify the task name as required. We recommend that you choose an informative task name.

  5. Enter information about the source and target databases. The following table describes the parameters.
    Database type Parameter Description
    Source database Instance Type The type of the source database instance. Select User-Created Database with Public IP Address.
    Instance Region The region that the source database instance belongs to. If you have configured access control for your instance, you must allow the public IP address range of the specified region to access the instance before configuring a migration task.
    Note You can click Get IP Address Segment of DTS to view and copy the IP address range of the region.
    Database Type The source database type. Select MySQL.
    Hostname/IP Address The endpoint of the AWS MySQL database.
    Port Number The port of the AWS MySQL database.
    Database Account An account with read and write permissions on the AWS MySQL database.
    Database Password The password of the account for accessing the MySQL database.
    Target database Instance Type Select RDS Instance.
    Instance Region The region that the target database instance belongs to.
    RDS Instance ID The ID of the target database instance in the selected region.
    Database Account An account with read and write permissions on the target database instance.
    Database Password The password of the account for accessing the target database instance.
    Encryption Select Non-encrypted or SSL-encrypted. The latter greatly increases CPU consumption.


  6. Click Test the Connection and confirm that the test results for both the source and target databases are Passed.
  7. Click Authorize Whitelist and Enter into Next Step in the lower right corner of the page.
  8. Select a migration type. In the Available area, select the target database and click to add the database to the Selected area.
    Note To maintain data consistency before and after migration, we recommend that you select Schema Migration, Full Data Migration, and Incremental Data Migration.

    Currently, schema migration and full data migration are free of charge, while incremental data migration is charged by hour based on link specifications.



  9. Click Precheck and wait until the precheck ends.
    Note If the precheck fails, you can fix the problems as instructed and run the precheck again.


  10. Click Next. In the Confirm Settings dialog box that appears, read the term and agree to the Data Transmission Service (Pay-As-You-Go) Service Terms, and click Buy and Start.

    If you select Incremental Data Migration, DTS synchronizes updates of the source database to the target RDS instance during the migration. The migration task does not end automatically. If you want to switch your service from AWS RDS to Alibaba Cloud RDS, we recommend that you use the following method. Pause data to write to the source database for a few minutes when incremental migration has no latency. Wait until the incremental migration enters non-latency status again. Stop the migration task and switch the service to the target RDS instance.

  11. Click the target region to view the migration status. The status will be Completed when the migration is completed.

    Note If no latency occurs during incremental data migration, the data on AWS and Alibaba Cloud RDS will be consistent and the migration task can be stopped.
    AWS clears binlogs as quickly as possible, and incremental data migration depends on the binlogs of the source database. To prevent unsynchronized binlogs from being cleared, you can call the AWS RDS stored procedure mysql.rds_set_configuration to set the binlog retention period. For example, to prolong the binlog retention period to one day, you can run the following command to call the stored procedure:
    call mysql.rds_set_configuration("binlog retention hours" 24)

    Now you have migrated MySQL data from AWS RDS to Alibaba Cloud RDS.