You can use Data Transmission Service (DTS) to synchronize data from an ApsaraDB RDS for MySQL instance to a PolarDB-X instance. PolarDB-X is a cloud-native distributed database that is highly compatible with MySQL and supports horizontal splitting, elastic scaling, and transparent read/write splitting.
Prerequisites
-
Data tables to be synchronized in the source database must have primary keys.
-
Ensure that the destination database has sufficient storage space.
-
A PolarDB-X instance is created. If you have not created one, see Create a PolarDB-X 1.0 instance and Create a database.
NoteWhen creating an instance, select RDS MySQL as the storage type.
Notes
-
During initial full data synchronization, DTS consumes read and write resources from the source and destination databases, which increases the database load. If database performance is poor, instance specifications are low, or business traffic is heavy (for example, the source database has many slow SQL queries or tables without primary keys, or the destination database experiences deadlocks), the database load increases and may even cause the service to become unavailable. Before you synchronize data, evaluate the performance of your source and destination instances. We recommend performing data synchronization during off-peak hours, for example, when the CPU utilization of both instances is below 30%.
-
Concurrent INSERT operations during full initialization cause table fragmentation in the destination cluster, so the tablespace of the destination cluster is larger than that of the source database after full initialization. Ensure that the destination database has sufficient storage space.
-
Initial schema synchronization is not currently supported for MySQL-to-PolarDB-X synchronization. You must create the corresponding databases and tables in the destination instance before you configure the synchronization job.
Billing details
|
Synchronization Type |
Link Configuration Fees |
|
Full data synchronization |
No charge. |
|
Incremental data synchronization |
Charged. For more information, see Billing overview. |
Limits
- You can select only tables as the objects to be synchronized.
- You cannot synchronize the following types of data: BIT, VARBIT, GEOMETRY, ARRAY, UUID, TSQUERY, TSVECTOR, and TXID_SNAPSHOT.
-
Tables with prefix indexes cannot be synchronized and may cause task failure.
- We recommend that you do not use gh-ost or pt-online-schema-change to perform data definition language (DDL) operations on objects during data synchronization. Otherwise, data synchronization may fail.
Supported SQL operations
INSERT, UPDATE, DELETE.
Database account permissions
|
database |
Required permissions |
|
RDS MySQL |
REPLICATION CLIENT, REPLICATION SLAVE, SHOW VIEW, and SELECT permissions on all objects to be synchronized. |
|
PolarDB-X |
Not required. DTS automatically creates an account and grants the necessary permissions. |
Supported sync topologies
-
One-to-one one-way synchronization.
-
Many-to-one one-way synchronization.
Preparations
Initial schema synchronization from RDS MySQL to PolarDB-X is not currently supported. You must create the corresponding databases and tables in the destination instance based on the schema of the objects to be synchronized from the source RDS MySQL instance. For more information, see Create a database and Create a table.
Structure initialization: Synchronizes object schema definitions from the source database to the destination database.
Procedure
-
Purchase a data synchronization task. For more information, see Purchase process.
NoteWhen purchasing, select the source instance as MySQL, the destination instance as PolarDB-X (formerly DRDS Upgrade Edition), and the synchronization topology as One-way Synchronization.
-
Log on to the DTS console.
NoteIf you are automatically redirected to the Data Management (DMS) console, you can click the
icon in the lower-right corner and then click
to return to the classic DTS console. -
In the left-side navigation pane, click Data Synchronization.
-
At the top of the Synchronization Tasks page, select the region where your destination instance is located.
-
Find the data synchronization task that you purchased and click Configure Task.
-
Configure source and destination instance information.
Category
Configuration
Description
None
Task name
DTS generates a default task name. We recommend that you use a descriptive name for easy identification. The name does not need to be unique.
Source instance information
Instance type
Select RDS Instance.
Region
The source region selected when purchasing the data synchronization instance. You cannot change this setting.
Instance ID
Select the ID of your source RDS MySQL instance.
Database account
Enter the database account for your source RDS instance. For required permissions, see Database account permissions.
NoteWhen the database type of the source RDS instance is MySQL 5.5 or MySQL 5.6, you do not need to configure the Database Account or Database Password.
Database password
Enter the password for the database account.
Connection method
Select Non-encrypted or SSL-encrypted based on your requirements. If you set it to SSL-encrypted, you must enable the SSL encryption feature for your RDS instance in advance. For more information, see Configure SSL Encryption.
ImportantCurrently, the Encryption parameter is available only for regions in the Chinese mainland and the China (Hong Kong) region.
Target Instance Information
Instance type
Fixed as DRDS Instance. You cannot change this setting.
Region
The destination region selected when purchasing the data synchronization instance. You cannot change this setting.
DRDS instance ID
Select the ID of your destination PolarDB-X (formerly DRDS) instance.
-
In the lower-right corner of the page, click Set Whitelist and Next.
If the source or destination database is an Alibaba Cloud database instance, such as an ApsaraDB RDS for MySQL or ApsaraDB for MongoDB instance, DTS automatically adds the CIDR blocks of DTS servers to the IP address whitelist of the instance. If the source or destination database is a self-managed database hosted on an Elastic Compute Service (ECS) instance, DTS automatically adds the CIDR blocks of DTS servers to the security group rules of the ECS instance, and you must make sure that the ECS instance can access the database. If the self-managed database is hosted on multiple ECS instances, you must manually add the CIDR blocks of DTS servers to the security group rules of each ECS instance. If the source or destination database is a self-managed database that is deployed in a data center or provided by a third-party cloud service provider, you must manually add the CIDR blocks of DTS servers to the IP address whitelist of the database to allow DTS to access the database. For more information, see Whitelist DTS server IP addresses.
WarningAdding the public IP address blocks of the DTS service, either automatically or manually, may pose security risks. Using this product, you acknowledge that you understand and accept the potential security risks and that you must implement basic security measures. These measures include, but are not limited to, strengthening password security, limiting the ports open to each CIDR block, using authentication for internal API calls, and regularly checking and restricting unnecessary CIDR blocks. Alternatively, you can connect through a private network using a leased line, VPN Gateway, or Smart Access Gateway.
-
Configure sync policies and object information.
Configuration item
Description
Select sync objects
In the Source Objects box, click the tables you want to synchronize, then click the
icon to move them to the Selected Objects box.Note-
You can only select tables as sync objects.
-
By default, sync object names remain unchanged. To rename sync objects in the destination instance, use DTS object name mapping. For more information, see Rename sync objects in the destination instance.
Mapping Name Change
Change the names of synchronized objects in the destination instance. For more information, see Map databases, tables, and columns.
Retry time for failed connection
If DTS cannot connect to the source or destination instance, it retries for 720 minutes (12 hours) by default. You can also specify a custom retry duration. If DTS reconnects to the source or destination instance within the specified duration, the synchronization task automatically resumes. Otherwise, the task fails.
NoteYou are billed for task run time during connection retries. Customize the retry duration based on your business needs, or release the DTS instance as soon as the source and destination instances are released.
-
-
Click Next.
-
Choose whether to perform initial full data synchronization.
NoteInitial full data synchronization: DTS synchronizes historical data from the source database to the destination database. If you skip this step, historical data will not be synchronized.
-
After completing the preceding configurations, click Precheck and Start in the lower-right corner of the page.
Note-
A precheck runs before the synchronization task starts, and you can only start the task after it passes.
-
If the precheck fails, click the
icon next to the failed item to view the details.-
You can fix the issues based on the cause and run the precheck again.
-
If you do not need to fix the items that triggered warnings, you can click Ignore or Ignore Warnings and Rerun Precheck to skip the warnings and run the precheck again.
-
-
-
After the Precheck dialog box displays Precheck Passed, close the Precheck dialog box. The synchronization task starts automatically.
-
Wait for the task to finish initialization and enter the Synchronizing state.
You can view the status of the data synchronization task on the Data Synchronization page.