Alibaba Cloud Data Transmission Service (DTS) allows you to exchange data between various data sources such as RDBMS, NoSQL, and OLAP. By taking the MySQL database as an example, this topic introduces how to configure a DTS migration task to migrate data in a database between two ECS instances.

Prerequisites

  • In the security group of the target ECS instance, allow inboud access to the port on which the MySQL server listens. The default MySQL port is 3306.
  • Create a non-root account for the MySQL databases on the source and target ECS instances.

    For example, you can run the following command to create an account for the MySQL database, with the name as dts and the password as 123456.

    grant all on *.*  to 'dts'@'%'  IDENTIFIED BY '123456';

Procedure

  1. Log on to the DTS console.
  2. In the left-side navigation pane, select Data Migration.
  3. Select the region of the target ECS instance, and click Create Migration Task.


  4. Configure a migration task.
    1. Specify a task name.

      You can use the default name or specify one.

    2. Configure the source database.
      Parameter Value
      Instance Type The database in the ECS instance.
      Instance Region The region to which the source ECS instance belongs.
      ECS Instance ID The ID of the source ECS instance. DTS supports ECS instances in classic networks or VPCs.
      Database Engine The type of the database in the source ECS instance, MySQL in this example.
      Port The port on which the MySQL server listens.
      Database Account The non-root account for accessing the MySQL database in the source ECS instance.
      Note The database account cannot be a root account. Otherwise, errors will occur during the connection test.
      Database Password The password for the non-root account.
    3. Click Test the Connection in the lower right corner of the Source Database area.

      If the result Test Passed is returned, the source database has connected.

    4. Configure the target database.
      Parameter Value
      Instance Type The database in the ECS instance.
      Instance Region The region to which the target ECS instance belongs.
      ECS Instance ID The ID of the target ECS instance. DTS supports ECS instances in classic networks or VPCs.
      Database Engine The same as the database in the source ECS instance, MySQL in this example.
      Port The port on which the MySQL server listens.
      Database Account The non-root account for accessing the MySQL database in the target ECS instance.
      Note The database account cannot be a root account. Otherwise, errors will occur during the connection test.
      Database Password The password for the non-root account.
    5. Click Test the Connection in the lower right corner of the Target Database area.

      If the result Test Passed is returned, the target database has connected.

    6. Click Authorize Whitelist and Enter into Next Step.
  5. Configure the migration type and migration object.
    1. Configure the migration type.
      • Zero downtime migration: Select Structure migration + Full data migration + Incremental data migration.
      • Full data migration: Select Structure migration + Full data migration.
    2. Configure the migration object.

      In the Migration Object box, click the database object to migrate, such as a database, table, or column. Then click > to add it to the Selected Objects box.

      Note By default, after a database object is By default, after a database object is migrated to a MySQL database in your ECS instance, the object name remains the same as that in the local MySQL database. If the migrated database object has different names on the source and target instances, you need to use the object name mapping function provided by DTS to meet the requirements. For more information, see Object name mapping.
  6. Click Pre-Check and Start.

    Before migration begins, DTS pre-checks the connectivity, authority, and log format of the database.

    After the pre-check is successful, you can view the status and progress of your tasks in the Migration Task List.