This topic describes how to synchronize data between ApsaraDB RDS for MySQL instances that belong to different Alibaba Cloud accounts by using Data Transmission Service (DTS).
Prerequisites
- The source and destination ApsaraDB RDS for MySQL instances are created. For more information, see Create an ApsaraDB RDS for MySQL instance.
- The database type of the source and destination ApsaraDB RDS instances is MySQL.
Precautions
- DTS uses read and write resources of the source and destination databases during initial full data synchronization. This may increase the loads of the database servers. If the database performance is unfavorable, the specification is low, or the data volume is large, database services may become unavailable. For example, DTS occupies a large amount of read and write resources in the following cases: a large number of slow SQL queries are performed on the source database, the tables have no primary keys, or a deadlock occurs in the destination database. Before you synchronize data, evaluate the impact of data synchronization on the performance of the source and destination databases. We recommend that you synchronize data during off-peak hours. For example, you can synchronize data when the CPU utilization of the source and destination databases is less than 30%.
- The tables to be migrated in the source database must have PRIMARY KEY or UNIQUE constraints and all fields must be unique. Otherwise, the destination database may contain duplicate data records.
- During initial full data synchronization, concurrent INSERT operations cause fragmentation in the tables of the destination instance. After initial full data synchronization is complete, the size of used tablespace of the destination instance is larger than that of the source instance.
Supported synchronization topologies
- One-way one-to-one synchronization
- One-way one-to-many synchronization
- One-way cascade synchronization
- One-way many-to-one synchronization
For more information about synchronization topologies, see Synchronization topologies.
SQL operations that can be synchronized
Operation type | SQL statement |
---|---|
DML | INSERT, UPDATE, DELETE, and REPLACE |
DDL |
|
Limits
- Incompatibility with triggers
If you select a database as the object to be synchronized and the database contains a trigger that updates a table, data inconsistency may occur. For more information about how to solve this issue, see Configure a data synchronization task for a source database that contains a trigger.
- Limits on RENAME TABLE operations
RENAME TABLE operations may cause data inconsistency during synchronization. For example, if only Table A needs to be synchronized and it is renamed Table B, Table B cannot be synchronized to the destination database. To prevent this situation, you can select the entire database where Table A is located as the object when you configure the data synchronization task.
Preparations
Set the Alibaba Cloud account that owns the destination ApsaraDB RDS for MySQL instance as a trusted account. This allows DTS to access the cloud resources of the Alibaba Cloud account that owns the source ApsaraDB RDS for MySQL instance. For more information, see Configure RAM authorization for cross-account data migration and synchronization.
Procedure
FAQ
The following table describes the common alert messages and the corresponding solutions when you configure the source database.
Alert message | Solution |
---|---|
![]() |
Check whether you specify a valid value for the Cloud Account or RAM Role Name parameter when you configure the source instance.
Note To obtain the ID of the Alibaba Cloud account that owns the source instance, you can
log on to the Account Management console by using this account. The account ID is displayed on the Security Settings
page.
|
![]() |