This topic describes the precautions and limits when you migrate data from a MySQL database, such as a self-managed MySQL database and an ApsaraDB RDS for MySQL instance. To ensure that your data migration task runs as expected, read the precautions and limits before you configure the task.

Scenarios of migrating data from a MySQL database

Take note of precautions and limits in the following data migration scenarios:

Migrate data between MySQL databases

The following table describes the precautions and limits when you migrate data between MySQL databases, such as self-managed MySQL databases and ApsaraDB RDS for MySQL instances.
Category Description
Limits on the source database
  • The server to which the source database belongs must have sufficient outbound bandwidth. Otherwise, the data migration speed decreases.
  • The tables to migrate must have PRIMARY KEY or UNIQUE constraints and all fields must be unique. Otherwise, the destination database may contain duplicate data records.
  • If you select tables as the objects to migrate and you need to edit tables (such as renaming tables or columns) in the destination database, up to 1,000 tables can be migrated in a single data migration task. If you run a task to migrate more than 1,000 tables, a request error occurs. In this case, we recommend that you split the tables and configure multiple tasks to migrate the tables, or configure a task to migrate the entire database.
  • If you want to migrate incremental data, you must make sure that the following requirements are met:
    • The binary logging feature is enabled. The value of the binlog_format parameter is set to row. The value of the binlog_row_image parameter is set to full. Otherwise, error messages are returned during precheck and the data migration task cannot be started.
      Notice If the self-managed MySQL database is deployed in a dual-primary cluster, you must set log_slave_updates to ON. This ensures that Data Transmission Service (DTS) can obtain all binary logs.
    • For an incremental data migration task, binary logs of the source database must be stored for more than 24 hours. For a full data and incremental data migration task, binary logs of the source database must be stored for at least seven days. After full data migration is complete, you can set the retention period to more than 24 hours. Otherwise, DTS may fail to obtain the binary logs and the task may fail. In exceptional circumstances, data inconsistency or loss may occur. Make sure that you set the retention period of binary logs based on the preceding requirements. Otherwise, the Service Level Agreement (SLA) of DTS does not ensure service reliability and performance.

  • Limits on operations:
    • During schema migration and full data migration, do not perform DDL operations to change the schemas of databases or tables. Otherwise, the data migration task fails.
    • If you perform only full data migration, do not write data to the source database during data migration. Otherwise, data inconsistency between the source and destination databases occurs. To ensure data consistency, we recommend that you select schema migration, full data migration, and incremental data migration as the migration types.
Other limits
  • To ensure compatibility, we recommend that you use the same engine versions for the source and destination MySQL databases.
  • Before you migrate data, evaluate the impact of data migration on the performance of the source and destination databases. We recommend that you migrate data during off-peak hours. During full data migration, DTS uses read and write resources of the source and destination databases. This may increase the loads of the database servers.
  • During full data migration, concurrent INSERT operations cause fragmentation in the tables of the destination database. After full data migration is complete, the size of used tablespace of the destination database is larger than that of the source database.
  • You must make sure that the precision settings for columns of the FLOAT or DOUBLE data type meet your business requirements. DTS uses the ROUND(COLUMN,PRECISION) function to retrieve values from columns of the FLOAT or DOUBLE data type. If you do not specify a precision, DTS sets the precision for the FLOAT data type to 38 digits and the precision for the DOUBLE data type to 308 digits.
  • DTS attempts to resume data migration tasks that failed within the last seven days. Before you switch workloads to the destination instance, stop or release the data migration task. You can also execute the REVOKE statement to revoke the write permissions from the accounts used by DTS to access the destination instance. Otherwise, the data in the source database overwrites the data in the destination instance after the task is resumed.
Special cases
  • If the source database is a self-managed MySQL database, take note of the following limits:
    • If you perform a primary/secondary switchover on the source database when the data migration task is running, the task fails.
    • DTS calculates migration latency based on the timestamp of the latest migrated data in the destination database and the current timestamp in the source database. If no DML operation is performed on the source database for a long time, the migration latency may be inaccurate. If the latency of the synchronization task is too high, you can perform a DML operation on the source database to update the latency.
      Note If you select an entire database as the object to migrate, you can create a heartbeat table. The heartbeat table is updated or receives data every second.
  • If the destination database runs on an ApsaraDB RDS for MySQL instance, take note of the following limits:

    DTS automatically creates a destination database in the ApsaraDB RDS for MySQL instance. However, if the name of the source database is invalid, you must manually create a database in the ApsaraDB RDS for MySQL instance before you configure the data migration task. For more information, see Create a database on an ApsaraDB RDS for MySQL instance.

Migrate data from a MySQL database to a PolarDB for MySQL cluster

The following table describes the precautions and limits when you migrate data from a MySQL database to a PolarDB for MySQL cluster.
Category Description
Limits on the source database
  • The server to which the source database belongs must have sufficient outbound bandwidth. Otherwise, the data migration speed decreases.
  • The tables to migrate must have PRIMARY KEY or UNIQUE constraints and all fields must be unique. Otherwise, the destination database may contain duplicate data records.
  • If you select tables as the objects to migrate and you need to edit tables (such as renaming tables or columns) in the destination database, up to 1,000 tables can be migrated in a single data migration task. If you run a task to migrate more than 1,000 tables, a request error occurs. In this case, we recommend that you split the tables and configure multiple tasks to migrate the tables, or configure a task to migrate the entire database.
  • If you want to migrate incremental data, you must make sure that the following requirements are met:
    • The binary logging feature is enabled. The value of the binlog_format parameter is set to row. The value of the binlog_row_image parameter is set to full. Otherwise, error messages are returned during precheck and the data migration task cannot be started.
      Notice If the self-managed MySQL database is deployed in a dual-primary cluster, you must set log_slave_updates to ON. This ensures that Data Transmission Service (DTS) can obtain all binary logs.
    • For an incremental data migration task, binary logs of the source database must be stored for more than 24 hours. For a full data and incremental data migration task, binary logs of the source database must be stored for at least seven days. After full data migration is complete, you can set the retention period to more than 24 hours. Otherwise, DTS may fail to obtain the binary logs and the task may fail. In exceptional circumstances, data inconsistency or loss may occur. Make sure that you set the retention period of binary logs based on the preceding requirements. Otherwise, the Service Level Agreement (SLA) of DTS does not ensure service reliability and performance.

  • Limits on operations:
    • During schema migration and full data migration, do not perform DDL operations to change the schemas of databases or tables. Otherwise, the data migration task fails.
    • If you perform only full data migration, do not write data to the source database during data migration. Otherwise, data inconsistency between the source and destination databases occurs. To ensure data consistency, we recommend that you select schema migration, full data migration, and incremental data migration as the migration types.
Other limits
  • To ensure compatibility, we recommend that you use the same engine versions for the source and destination MySQL databases.
  • Before you migrate data, evaluate the impact of data migration on the performance of the source and destination databases. We recommend that you migrate data during off-peak hours. During full data migration, DTS uses read and write resources of the source and destination databases. This may increase the loads of the database servers.
  • During full data migration, concurrent INSERT operations cause fragmentation in the tables of the destination database. After full data migration is complete, the size of used tablespace of the destination database is larger than that of the source database.
  • You must make sure that the precision settings for columns of the FLOAT or DOUBLE data type meet your business requirements. DTS uses the ROUND(COLUMN,PRECISION) function to retrieve values from columns of the FLOAT or DOUBLE data type. If you do not specify a precision, DTS sets the precision for the FLOAT data type to 38 digits and the precision for the DOUBLE data type to 308 digits.
  • DTS attempts to resume data migration tasks that failed within the last seven days. Before you switch workloads to the destination instance, stop or release the data migration task. You can also execute the REVOKE statement to revoke the write permissions from the accounts used by DTS to access the destination instance. Otherwise, the data in the source database overwrites the data in the destination instance after the task is resumed.
Special cases
  • If the source database is a self-managed MySQL database, take note of the following limits:
    • If you perform a primary/secondary switchover on the source database when the data migration task is running, the task fails.
    • DTS calculates migration latency based on the timestamp of the latest migrated data in the destination database and the current timestamp in the source database. If no DML operation is performed on the source database for a long time, the migration latency may be inaccurate. If the latency of the synchronization task is too high, you can perform a DML operation on the source database to update the latency.
      Note If you select an entire database as the object to migrate, you can create a heartbeat table. The heartbeat table is updated or receives data every second.
  • If the destination database runs on a PolarDB for MySQL cluster, take note of the following limits:

    DTS automatically creates a destination database in the PolarDB for MySQL cluster. However, if the name of the source database is invalid, you must manually create a database in the PolarDB for MySQL cluster before you configure the data migration task. For more information, see Database Management.

Migrate data from a MySQL database to a PolarDB-X instance

The following table describes the precautions and limits.
Category Description
Limits on the source database
  • The server to which the source database belongs must have sufficient outbound bandwidth. Otherwise, the data migration speed decreases.
  • The tables to migrate must have PRIMARY KEY or UNIQUE constraints and all fields must be unique. Otherwise, the destination database may contain duplicate data records.
  • If you select tables as the objects to migrate and you need to edit tables (such as renaming tables or columns) in the destination database, up to 1,000 tables can be migrated in a single data migration task. If you run a task to migrate more than 1,000 tables, a request error occurs. In this case, we recommend that you split the tables and configure multiple tasks to migrate the tables, or configure a task to migrate the entire database.
  • If you want to migrate incremental data, you must make sure that the following requirements are met:
    • The binary logging feature is enabled. The value of the binlog_format parameter is set to row. The value of the binlog_row_image parameter is set to full. Otherwise, error messages are returned during precheck and the data migration task cannot be started.
      Notice If the self-managed MySQL database is deployed in a dual-primary cluster, you must set log_slave_updates to ON. This ensures that Data Transmission Service (DTS) can obtain all binary logs.
    • For an incremental data migration task, binary logs of the source database must be stored for more than 24 hours. For a full data and incremental data migration task, binary logs of the source database must be stored for at least seven days. After full data migration is complete, you can set the retention period to more than 24 hours. Otherwise, DTS may fail to obtain the binary logs and the task may fail. In exceptional circumstances, data inconsistency or loss may occur. Make sure that you set the retention period of binary logs based on the preceding requirements. Otherwise, the Service Level Agreement (SLA) of DTS does not ensure service reliability and performance.

  • Limits on operations:
    • During full data migration, do not perform DDL operations to change the schemas of databases or tables. Otherwise, the data migration task fails.
    • If you perform only full data migration, do not write data to the source database during data migration. Otherwise, data inconsistency between the source and destination databases occurs. To ensure data consistency, we recommend that you select full data migration and incremental data migration as the migration types.
Other limits
  • The storage type of the PolarDB-X instance must be ApsaraDB RDS for MySQL (private custom RDS instance). PolarDB for MySQL cannot be used as the storage type.
  • Before you configure a data migration task, you must create databases and tables in the destination instance.
  • Before you migrate data, evaluate the impact of data migration on the performance of the source and destination databases. We recommend that you migrate data during off-peak hours. During full data migration, DTS uses read and write resources of the source and destination databases. This may increase the loads of the database servers.
  • During full data migration, concurrent INSERT operations cause fragmentation in the tables of the destination database. After full data migration is complete, the size of used tablespace of the destination database is larger than that of the source database.
  • You must make sure that the precision settings for columns of the FLOAT or DOUBLE data type meet your business requirements. DTS uses the ROUND(COLUMN,PRECISION) function to retrieve values from columns of the FLOAT or DOUBLE data type. If you do not specify a precision, DTS sets the precision for the FLOAT data type to 38 digits and the precision for the DOUBLE data type to 308 digits.
  • DTS attempts to resume data migration tasks that failed within the last seven days. Before you switch workloads to the destination instance, stop or release the data migration task. You can also execute the REVOKE statement to revoke the write permissions from the accounts used by DTS to access the destination instance. Otherwise, the data in the source database overwrites the data in the destination instance after the task is resumed.
Special cases
If the source database is a self-managed MySQL database, take note of the following limits:
  • If you perform a primary/secondary switchover on the source database when the data migration task is running, the task fails.
  • DTS calculates migration latency based on the timestamp of the latest migrated data in the destination database and the current timestamp in the source database. If no DML operation is performed on the source database for a long time, the migration latency may be inaccurate. If the latency of the synchronization task is too high, you can perform a DML operation on the source database to update the latency.
    Note If you select an entire database as the object to migrate, you can create a heartbeat table. The heartbeat table is updated or receives data every second.

Migrate data from a MySQL database to an AnalyticDB for MySQL cluster

The following table describes the precautions and limits.
Category Description
Limits on the source database
  • The server to which the source database belongs must have sufficient outbound bandwidth. Otherwise, the data migration speed decreases.
  • The tables to migrate must have PRIMARY KEY or UNIQUE constraints and all fields must be unique. Otherwise, the destination database may contain duplicate data records.
  • If you select tables as the objects to migrate and you need to edit tables (such as renaming tables or columns) in the destination database, up to 1,000 tables can be migrated in a single data migration task. If you run a task to migrate more than 1,000 tables, a request error occurs. In this case, we recommend that you split the tables and configure multiple tasks to migrate the tables, or configure a task to migrate the entire database.
  • If you want to migrate incremental data, you must make sure that the following requirements are met:
    • The binary logging feature is enabled. The value of the binlog_format parameter is set to row. The value of the binlog_row_image parameter is set to full. Otherwise, error messages are returned during precheck and the data migration task cannot be started.
      Notice If the self-managed MySQL database is deployed in a dual-primary cluster, you must set log_slave_updates to ON. This ensures that Data Transmission Service (DTS) can obtain all binary logs.
    • For an incremental data migration task, binary logs of the source database must be stored for more than 24 hours. For a full data and incremental data migration task, binary logs of the source database must be stored for at least seven days. After full data migration is complete, you can set the retention period to more than 24 hours. Otherwise, DTS may fail to obtain the binary logs and the task may fail. In exceptional circumstances, data inconsistency or loss may occur. Make sure that you set the retention period of binary logs based on the preceding requirements. Otherwise, the Service Level Agreement (SLA) of DTS does not ensure service reliability and performance.

  • Limits on operations:
    • During schema migration and full data migration, do not perform DDL operations to change the schemas of databases or tables. Otherwise, the data migration task fails.
    • During data migration, do not perform DDL operations to add comments. Example: ALTER TABLE table_name COMMENT='Table comment';. Otherwise, the data migration task fails.
    • If you perform only full data migration, do not write data to the source database during data migration. Otherwise, data inconsistency between the source and destination databases occurs. To ensure data consistency, we recommend that you select schema migration, full data migration, and incremental data migration as the migration types.
Other limits
  • Prefix indexes cannot be migrated. If the source database contains prefix indexes, data may fail to be migrated.
  • Due to the limits of AnalyticDB for MySQL, if the disk space usage of the nodes in an AnalyticDB for MySQL cluster reaches 80%, the task is delayed and error messages are returned. We recommend that you estimate the required disk space based on the objects to migrate. You must make sure that the destination cluster has sufficient storage space.
  • Before you migrate data, evaluate the impact of data migration on the performance of the source and destination databases. We recommend that you migrate data during off-peak hours. During full data migration, DTS uses read and write resources of the source and destination databases. This may increase the loads of the database servers.
  • During full data migration, concurrent INSERT operations cause fragmentation in the tables of the destination database. After full data migration is complete, the size of used tablespace of the destination database is larger than that of the source database.
  • You must make sure that the precision settings for columns of the FLOAT or DOUBLE data type meet your business requirements. DTS uses the ROUND(COLUMN,PRECISION) function to retrieve values from columns of the FLOAT or DOUBLE data type. If you do not specify a precision, DTS sets the precision for the FLOAT data type to 38 digits and the precision for the DOUBLE data type to 308 digits.
  • DTS attempts to resume data migration tasks that failed within the last seven days. Before you switch workloads to the destination instance, stop or release the data migration task. You can also execute the REVOKE statement to revoke the write permissions from the accounts used by DTS to access the destination instance. Otherwise, the data in the source database overwrites the data in the destination instance after the task is resumed.
Special cases
If the source database is a self-managed MySQL database, take note of the following limits:
  • If you perform a primary/secondary switchover on the source database when the data migration task is running, the task fails.
  • DTS calculates migration latency based on the timestamp of the latest migrated data in the destination database and the current timestamp in the source database. If no DML operation is performed on the source database for a long time, the migration latency may be inaccurate. If the latency of the synchronization task is too high, you can perform a DML operation on the source database to update the latency.
    Note If you select an entire database as the object to migrate, you can create a heartbeat table. The heartbeat table is updated or receives data every second.

Migrate data from a MySQL database to a self-managed Kafka cluster

The following table describes the precautions and limits.
Category Description
Limits on the source database
  • The server to which the source database belongs must have sufficient outbound bandwidth. Otherwise, the data migration speed decreases.
  • The tables to migrate must have PRIMARY KEY or UNIQUE constraints and all fields must be unique. Otherwise, the destination database may contain duplicate data records.
  • If you select tables as the objects to migrate and you need to edit tables (such as renaming tables or columns) in the destination database, up to 1,000 tables can be migrated in a single data migration task. If you run a task to migrate more than 1,000 tables, a request error occurs. In this case, we recommend that you split the tables and configure multiple tasks to migrate the tables, or configure a task to migrate the entire database.
  • If you want to migrate incremental data, you must make sure that the following requirements are met:
    • The binary logging feature is enabled in the ApsaraDB RDS console. For more information, see Configure the parameters of an ApsaraDB RDS for MySQL instance. The value of the binlog_format parameter is set to row. The value of the binlog_row_image parameter is set to full. Otherwise, error messages are returned during precheck and the data synchronization task cannot be started.
      Notice If the self-managed MySQL database is deployed in a dual-primary cluster, you must set log_slave_updates to ON. This ensures that DTS can obtain all binary logs. For more information, see Create an account for a user-created MySQL database and configure binary logging.
    • For an incremental data migration, binary logs of the source database must be stored for more than 24 hours. For a schema and incremental data migration, binary logs of the source database must be stored for at least seven days. After schema migration is complete, you can set the retention period to more than 24 hours. Otherwise, DTS may fail to obtain the binary logs and the task may fail. In exceptional circumstances, data inconsistency or loss may occur. Make sure that you set the retention period of binary logs in accordance with the preceding requirements. Otherwise, the SLA of DTS does not ensure service reliability and performance. For more information about binary log files and log backup files of an ApsaraDB RDS for MySQL instance, see Introduction to binary log files and log backup files of an ApsaraDB RDS for MySQL instance.

  • Limits on operations:
    • During schema migration and full data migration, do not perform DDL operations to change the schemas of databases or tables. Otherwise, the data migration task fails.
    • If you perform only full data migration, do not write data to the source database during data migration. Otherwise, data inconsistency between the source and destination databases occurs. To ensure data consistency, we recommend that you select schema migration, full data migration, and incremental data migration as the migration types.
Limits
  • Before you configure a data migration task, you must create a Kafka cluster and the Kafka version must be 0.10.1.0 to 2.0.
  • You can select only tables as objects to migrate.
  • Before you migrate data, evaluate the impact of data migration on the performance of the source and destination databases. We recommend that you migrate data during off-peak hours. During full data migration, DTS uses read and write resources of the source and destination databases. This may increase the loads of the database servers.
  • During full data migration, concurrent INSERT operations cause fragmentation in the tables of the destination database. After full data migration is complete, the size of used tablespace of the destination database is larger than that of the source database.
  • You must make sure that the precision settings for columns of the FLOAT or DOUBLE data type meet your business requirements. DTS uses the ROUND(COLUMN,PRECISION) function to retrieve values from columns of the FLOAT or DOUBLE data type. If you do not specify a precision, DTS sets the precision for the FLOAT data type to 38 digits and the precision for the DOUBLE data type to 308 digits.
  • DTS attempts to resume data migration tasks that failed within the last seven days. Before you switch workloads to the destination instance, stop or release the data migration task. You can also execute the REVOKE statement to revoke the write permissions from the accounts used by DTS to access the destination instance. Otherwise, the data in the source database overwrites the data in the destination instance after the task is resumed.
  • We recommend that you do not use tools other than DTS to write data to the destination database. Otherwise, data inconsistency between the source and destination databases occurs.
Special cases
If the source database is a self-managed MySQL database, take note of the following limits:
  • If you perform a primary/secondary switchover on the source database when the data migration task is running, the task fails.
  • DTS calculates migration latency based on the timestamp of the latest migrated data in the destination database and the current timestamp in the source database. If no DML operation is performed on the source database for a long time, the migration latency may be inaccurate. If the latency of the synchronization task is too high, you can perform a DML operation on the source database to update the latency.
    Note If you select an entire database as the object to migrate, you can create a heartbeat table. The heartbeat table is updated or receives data every second.

Migrate data from a MySQL database to a DataHub project

The following table describes the precautions and limits.
Category Description
Limits on the source database
  • The server to which the source database belongs must have sufficient outbound bandwidth. Otherwise, the data migration speed decreases.
  • The tables to migrate must have PRIMARY KEY or UNIQUE constraints and all fields must be unique. Otherwise, the destination database may contain duplicate data records.
  • If you select tables as the objects to migrate and you need to edit tables (such as renaming tables or columns) in the destination database, up to 1,000 tables can be migrated in a single data migration task. If you run a task to migrate more than 1,000 tables, a request error occurs. In this case, we recommend that you split the tables and configure multiple tasks to migrate the tables, or configure a task to migrate the entire database.
  • If you want to migrate incremental data, you must make sure that the following requirements are met:
    • The binary logging feature is enabled in the ApsaraDB RDS console. For more information, see Configure the parameters of an ApsaraDB RDS for MySQL instance. The value of the binlog_format parameter is set to row. The value of the binlog_row_image parameter is set to full. Otherwise, error messages are returned during precheck and the data synchronization task cannot be started.
      Notice If the self-managed MySQL database is deployed in a dual-primary cluster, you must set log_slave_updates to ON. This ensures that DTS can obtain all binary logs. For more information, see Create an account for a user-created MySQL database and configure binary logging.
    • For an incremental data migration, binary logs of the source database must be stored for more than 24 hours. For a schema and incremental data migration, binary logs of the source database must be stored for at least seven days. After schema migration is complete, you can set the retention period to more than 24 hours. Otherwise, DTS may fail to obtain the binary logs and the task may fail. In exceptional circumstances, data inconsistency or loss may occur. Make sure that you set the retention period of binary logs in accordance with the preceding requirements. Otherwise, the SLA of DTS does not ensure service reliability and performance. For more information about binary log files and log backup files of an ApsaraDB RDS for MySQL instance, see Introduction to binary log files and log backup files of an ApsaraDB RDS for MySQL instance.

  • Limits on operations: During schema migration, do not perform DDL operations to change the schemas of databases or tables. Otherwise, the data migration task fails.
Other limits
  • Only tables can be selected as objects to migrate.
  • We recommend that you do not use gh-ost or pt-online-schema-change to perform DDL operations on objects during data migration. Otherwise, data migration may fail.
  • If you use only DTS to write data to the destination database, you can use Data Management (DMS) to perform online DDL operations on source tables during data synchronization. For more information, see Change schemas without locking tables.
    Warning If you use tools other than DTS to write data to the destination database, we recommend that you do not use DMS to perform online DDL operations. Otherwise, data loss may occur in the destination database.
  • You must make sure that the precision settings for columns of the FLOAT or DOUBLE data type meet your business requirements. DTS uses the ROUND(COLUMN,PRECISION) function to retrieve values from columns of the FLOAT or DOUBLE data type. If you do not specify a precision, DTS sets the precision for the FLOAT data type to 38 digits and the precision for the DOUBLE data type to 308 digits.
  • DTS attempts to resume data migration tasks that failed within the last seven days. Before you switch workloads to the destination instance, stop or release the data migration task. You can also execute the REVOKE statement to revoke the write permissions from the accounts used by DTS to access the destination instance. Otherwise, the data in the source database overwrites the data in the destination instance after the task is resumed.
Special cases
If the source database is a self-managed MySQL database, take note of the following limits:
  • If you perform a primary/secondary switchover on the source database when the data migration task is running, the task fails.
  • DTS calculates migration latency based on the timestamp of the latest migrated data in the destination database and the current timestamp in the source database. If no DML operation is performed on the source database for a long time, the migration latency may be inaccurate. If the latency of the synchronization task is too high, you can perform a DML operation on the source database to update the latency.
    Note If you select an entire database as the object to migrate, you can create a heartbeat table. The heartbeat table is updated or receives data every second.