PolarDB-X is a cloud-native distributed database product developed by Alibaba Cloud to address the bottlenecks of single-node database services. PolarDB-X is highly compatible with the MySQL protocol and syntax. It supports automatic horizontal partitioning, online scaling, elastic scaling, and transparent read/write splitting. It also provides full lifecycle management capabilities for databases. You can use Data Transmission Service (DTS) to synchronize data between PolarDB-X instances.
Prerequisites
-
The databases in your PolarDB-X instance must be created on ApsaraDB RDS for MySQL.
-
The tables to be synchronized must have a primary key.
-
Ensure that the ApsaraDB RDS for MySQL instances for the destination PolarDB-X instance have sufficient storage space.
-
The source PolarDB-X instance must be version 5.2 or later. For information about how to view the instance version, see Instance version overview.
Usage 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%.
-
During data synchronization, do not perform operations such as scaling, migrating hot tables, changing sharding keys, or executing DDL statements on the PolarDB-X instance. These operations can cause the data synchronization task to fail.
-
If you need to change the network type of a PolarDB-X instance during data synchronization, you must update the task's network connection information afterward.
Billing
Synchronization type | Pricing |
Schema synchronization and full data synchronization | Free of charge. |
Incremental data synchronization | Charged. For more information, see Billing overview. |
Supported SQL operations
INSERT, UPDATE, and DELETE.
Before you begin
Because data synchronization between PolarDB-X instances does not support schema synchronization, you must create the corresponding databases and tables in the target PolarDB-X instance based on the data structure of the objects to be synchronized in the source PolarDB-X instance. For more information, see Create a database and Basic SQL operations.
Schema synchronization: Synchronizes the schema definitions of objects from the source database to the destination database.
Procedure
-
Purchase a data synchronization task. For more information, see Purchase procedure.
NoteWhen you purchase the task, select PolarDB-X (formerly DRDS) for both the source and destination instance types, and select One-way Synchronization for the synchronization topology.
-
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 the source and destination instances.
Section
Parameter
Description
N/A
Synchronization task name
DTS automatically generates a task name. We recommend specifying a more descriptive name to help you identify the task.
Source instance details
Instance type
This is set to DRDS Instance and cannot be changed.
Instance region
This is the region of the source instance that you selected during purchase. This parameter cannot be changed.
DRDS instance ID
Select the ID of the source PolarDB-X instance.
Destination instance details
Instance type
This is set to DRDS Instance and cannot be changed.
Instance region
This is the region of the destination instance that you selected during purchase. This parameter cannot be changed.
DRDS instance ID
Select the ID of the destination PolarDB-X 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 the synchronization policy and objects.
Parameter
Description
Processing mode for existing destination tables
-
Precheck and Report Errors: Checks if the destination tables are empty. If they are, the check passes. If not, the pre-check fails with an error, and the data synchronization task does not start.
Ignore Errors and Proceed: Skips the check that determines whether the target table is empty.
WarningIf you select Ignore Errors and Proceed, data inconsistencies may occur and introduce business risks. For example:
-
If table schemas match and a destination record has the same primary key value as a source record, DTS keeps the destination record and does not synchronize the source record.
-
If the table schemas are different, data might be only partially synchronized, or the synchronization task could fail.
-
Select synchronization objects
In the Source Objects box, click the table that you want to synchronize, and then click the
icon to move it to the Selected Objects box.Note-
The synchronization objects must be tables.
-
By default, the names of the synchronized objects remain unchanged. If you need to rename an object in the destination instance, use the object name mapping feature provided by DTS. For more information, see Map object names.
Map names
Change the names of synchronized objects in the destination instance. For more information, see Map databases, tables, and columns.
Connection retry duration
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 full data synchronization.
NoteFull data synchronization: DTS synchronizes the existing data from the source tables to the destination tables. If you do not select this option, the existing data is not 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.