Migrate data between self-managed databases on ECS instances

更新时间:
复制 MD 格式

Configure a DTS migration task to migrate data between self-managed MySQL databases on ECS instances with zero downtime.

Background

DTS supports homogeneous and heterogeneous data migrations with ETL features such as data filtering and database-, table-, and column-level mapping. DTS enables zero-downtime migrations, keeping the source database available throughout the process. For supported database types, see Data migration.

The following figure shows data migration between self-managed databases on ECS instances.

image

Prerequisites

  • The MySQL listening port (default: 3306) is open in the security group of the destination ECS instance.

  • The security group of the source ECS instance allows the DTS server IP address ranges for the destination instance.

  • Non-root MySQL accounts are created on the source and destination ECS instances.

    For example, create a MySQL account with username dts and password Test@123456:

    # Step 1: Create an account and configure its password.
    CREATE USER 'dts'@'%' IDENTIFIED BY 'Test@123456';
    
    # Step 2: Grant privileges.
    GRANT ALL PRIVILEGES ON *.* TO 'dts'@'%';
    
    # Step 3: Flush privileges.
    FLUSH PRIVILEGES;

Usage notes

Supported database versions and limitations vary. See Migration scenarios.

Procedure

  1. Log on to the DTS console.

  2. In the left-side navigation pane, click Data Migration.

  3. Select the region of the ECS instances and click Create Task.

  4. Configure the source and destination databases.

    1. Specify a task name.

      DTS auto-generates a task name. You can specify a descriptive name. The name does not need to be unique.

    2. Configure the source database.

      DTS supports self-managed databases accessible over the Internet or through VPN Gateway, Express Connect, or Smart Access Gateway. This example uses Internet access. For other access methods, see Migration scenarios.

      Parameter

      Description

      Database Type

      The database type on the source ECS instance. Example: MySQL.

      Access Method

      The access method based on database deployment. Example: Self-managed Database on ECS.

      Instance Region

      The source ECS instance region. Example: China (Hangzhou).

      Replicate Data Across Alibaba Cloud Accounts

      Specifies whether to migrate data across Alibaba Cloud accounts. Example: No.

      ECS Instance ID

      The source ECS instance ID.

      Port

      The MySQL listening port. Default: 3306.

      Database Account

      The non-root MySQL account on the source ECS instance. Example: dts.

      Important

      The account must be non-root. Otherwise, the connectivity test fails.

      Database Password

      The account password.

    3. Configure the destination database.

      Parameter

      Description

      Database Type

      The database type on the destination ECS instance. Must match the source database type. Example: MySQL.

      Access Method

      The access method of the destination database. Example: Self-managed Database on ECS.

      Instance Region

      The destination ECS instance region. Example: China (Beijing).

      ECS Instance ID

      The destination ECS instance ID. DTS supports instances in VPCs.

      Port

      The MySQL listening port. Default: 3306.

      Database Account

      The non-root MySQL account on the destination ECS instance. Example: dts.

      Note

      The account must be non-root. Otherwise, the connectivity test fails.

      Database Password

      The account password.

    4. In the lower part of the page, click Test Connectivity and Proceed.

    5. If your self-managed database uses a whitelist for security, copy the DTS server IP addresses from the dialog box and add them to the whitelist of your self-managed database. Then, click Test Connectivity.

      Warning

      Adding the public IP address blocks of DTS servers, whether automatically or manually, may introduce security risks. Using this product, you acknowledge and accept these potential risks. You must implement basic security measures, such as using strong passwords, limiting open ports for each CIDR block, using authentication for internal API calls, and regularly checking and restricting unnecessary CIDR blocks. You can also connect using an internal network, such as a leased line, VPN Gateway, or Smart Access Gateway.

  5. Configure migration types, migration objects, and trigger migration method.

    1. Configure migration types.

      • For zero-downtime migration with continuous writes to the source database, select Schema Migration, Full Data Migration, and Incremental Data Migration.

        Note

        If Incremental Data Migration is not selected, do not write data to the source database during migration to ensure data consistency.

      • To migrate during downtime or when no new data is written, select Schema Migration and Full Data Migration.

    2. Configure migration objects.

      In the Source Objects list, select the objects to migrate, such as databases, tables, or columns, and click the 2023-09-08_17-04-13.png icon to add them to Selected Objects.

      Note

      By default, object names remain unchanged after migration. To rename objects in the destination database, use the object name mapping feature in DTS.

  6. Complete the remaining configurations. Run a precheck, purchase a DTS instance, complete the payment, and start the migration task.

    DTS checks connectivity, permissions, and log formats before starting the migration. The following figure shows a successful precheck.image

    After the precheck completes, view the migration task status and progress in the Data Migration Tasks section on the Data Migration page.

    image