Migrating an Entire MySQL Database to RDS

Scenario

This section describes how to migrate the entire on-premises MySQL database to RDS using the CDM's entire DB migration function.

Currently, CDM can migrate the entire on-premises MySQL database to RDS for MySQL, RDS for PostgreSQL, or RDS for SQL Server. The following describes how to migrate the entire database to RDS. The procedure is as follows:

  1. Creating a CDM Cluster and Binding an EIP to the Cluster

  2. Creating a MySQL Link

  3. Creating an RDS Link

  4. Creating an Entire DB Migration Job

Prerequisites

  • You have sufficient EIP quota.

  • You have obtained an RDS database instance and the database engine of this instance is MySQL.

  • The on-premises MySQL database can be accessed through the public network. If the MySQL database is deployed on an on-premises data center or a third-party cloud, ensure that an IP address that can be accessed from the public network has been configured for the MySQL database, or the VPN or Direct Connect between the on-premises data center and the cloud service platform has been established.

  • You have obtained the IP addresses, names, usernames, and passwords of the on-premises MySQL database and RDS for MySQL.

  • You have uploaded a MySQL database driver by following the instructions provided in Managing Drivers.

Creating a CDM Cluster and Binding an EIP to the Cluster

  1. Create a CDM cluster by following the instructions in Creating a Cluster.

    The key configurations are as follows:

    • The flavor of the CDM cluster is selected based on the amount of data to be migrated. Generally, cdm.medium meets the requirements for most migration scenarios.

    • The CDM cluster and the RDS for MySQL instance must be in the same VPC. In addition, it is recommended that the CDM cluster be in the same subnet and security group as the RDS for MySQL instance.

    • If the same subnet and security group cannot be used for security purposes, ensure that a security group rule has been configured to allow the CDM cluster to access the RDS for MySQL instance.

  2. After the CDM cluster is created, on the Cluster Management page, click Bind EIP in the Operation column to bind an EIP to the cluster. The CDM cluster uses the EIP to access the on-premises MySQL database.

    **Figure 1** Cluster list

    Figure 1 Cluster list

    Note

    If SSL encryption is configured for the access channel of a local data source, CDM cannot connect to the data source using the EIP.

Creating an Entire DB Migration Job

  1. After the two links are created, choose Entire DB Migration > Create Job to create a migration job. See Figure 2.

    **Figure 2** Creating an entire DB migration job

    Figure 2 Creating an entire DB migration job

    • Job Name: Enter a name for the entire DB migration job.

    • Source Job Configuration

      • Source Link Name: Select the mysql_link link created in Creating a MySQL Link.

      • Schema/Tablespace: Select the on-premises MySQL database from which data is to be exported.

    • Destination Job Configuration

      • Destination Link Name: Select the rds_link link created in Creating an RDS Link.

      • Schema/Tablespace: Select the name of the RDS database to which data is to be imported.

      • Auto Table Creation: Select Auto creation, which indicates that CDM automatically creates tables in the RDS database when tables of the on-premises MySQL database do not exist in the RDS database.

      • Clear Data Before Import: Select Yes, which indicates that when a table with the same name as the table in the on-premises MySQL database exists in the RDS database, CDM clears data in the table on RDS.

      • Retain the default values of the optional parameters in Show Advanced Attributes.

  2. Click Next. The page for selecting tables to be migrated is displayed. You can select all or part of tables to migrate.

  3. Click Save and Run and CDM immediately starts the entire DB migration job.

    When the job starts running, a sub-job will be generated for each table. You can click the job name to view the sub-job list.

  4. In the Operation column of the job, click Historical Record to view the job's historical execution records and read/write statistics.

    There are no logs for the entire DB migration job. However, the sub-jobs have logs. On the Historical Record page of the sub-jobs, click Log to view the job logs.