Data Transmission Service (DTS) can synchronize data from a PolarDB for MySQL cluster to an AnalyticDB for PostgreSQL instance, enabling ad hoc queries, ETL processing, and visual exploration of massive datasets.
Prerequisites
-
The PolarDB for MySQL cluster has binary logging enabled. For more information, see How to enable binary logging.
-
Each table to be synchronized in the PolarDB for MySQL cluster must have a primary key.
-
A target AnalyticDB for PostgreSQL instance is created. For more information, see Create an AnalyticDB for PostgreSQL instance.
Precautions
-
Full data synchronization increases the load on both source and destination databases. The impact is greater if your databases have low specifications, poor performance, or high traffic (such as slow SQL queries, tables without primary keys, or deadlocks), and may cause service outages. Evaluate database performance before synchronization and run the task during off-peak hours, for example, when CPU utilization of both databases is below 30%.
-
During full data synchronization, concurrent INSERT operations can cause table fragmentation in the destination instance. As a result, table space in the destination instance will be larger than in the source cluster.
-
If the source data to be synchronized contains the date value
0000-00-00 00:00:00, the task may fail.NoteDTS converts this date value to
nullwhen it synchronizes the value to the destination database. You can temporarily change the source data to0001-01-01 00:00:00or set the corresponding field in the destination database to allow null values.
Billing
|
Synchronization type |
Pricing |
|
Schema synchronization and full data synchronization |
Free of charge. |
|
Incremental data synchronization |
Charged. For more information, see Billing overview. |
Limitations
-
You can select only tables as synchronization objects.
-
DTS does not support the synchronization of the following data types: BIT, VARBIT, GEOMETRY, ARRAY, UUID, TSQUERY, TSVECTOR, TXID_SNAPSHOT, and POINT.
-
Tables with prefix indexes cannot be synchronized and may cause task failure.
-
During data synchronization, do not use online DDL tools such as gh-ost or pt-online-schema-change to perform schema changes on the synchronization objects. Otherwise, the synchronization task will fail.
Supported SQL operations
-
DML operations: INSERT, UPDATE, and DELETE.
-
DDL operation: ADD COLUMN.
NoteThe CREATE TABLE operation is not supported. To synchronize a new table, you must add it as a synchronization object.
Supported synchronization topologies
-
One-to-one, one-way synchronization.
-
One-to-many, one-way synchronization.
-
Many-to-one, one-way synchronization.
Term mappings
|
PolarDB for MySQL |
AnalyticDB for PostgreSQL |
|
Database |
Schema |
|
Table |
Table |
Procedure
-
Purchase a data synchronization task. For more information, see Purchase a DTS task.
NoteOn the purchase page, select PolarDB as the source instance, AnalyticDB for PostgreSQL as the destination instance, and One-way Synchronization for the synchronization topology.
-
Log on to the DTS console.
-
In the left-side navigation pane, click Data Synchronization.
-
At the top of the Synchronization Tasks page, select the region where the destination instance is located.
-
Find your data synchronization task and click Configure Synchronization Channel.
-
Configure the source and destination instances.
Section
Parameter
Description
N/A
Synchronization Task Name
DTS generates a task name automatically. We recommend that you specify a descriptive name for easy identification. The name does not need to be unique.
Source Instance Details
Instance Type
The value is fixed as PolarDB.
Instance Region
The region of the source PolarDB for MySQL cluster. This was selected when you purchased the data synchronization task and cannot be changed.
PolarDB Instance ID
Select the ID of the PolarDB for MySQL cluster.
Database Account
Enter the database account of the PolarDB for MySQL cluster.
NoteThe account must have read permissions on the objects to be synchronized.
Database Password
Enter the password for the specified database account.
Destination Instance Details
Instance Type
The value is fixed as AnalyticDB for PostgreSQL and cannot be changed.
Instance Region
The region of the destination instance. This value was selected when you purchased the data synchronization task and cannot be changed.
Instance ID
Select the ID of the AnalyticDB for PostgreSQL instance.
Database Name
Enter the name of the destination database in the AnalyticDB for PostgreSQL instance.
Database Account
Enter the initial account of the AnalyticDB for PostgreSQL instance. For more information, see Create and manage database accounts.
NoteYou can also enter an account with RDS_SUPERUSER permissions. For more information, see Manage user permissions.
Database Password
Enter the password for the specified database account.
-
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.
Category
Parameter
Description
Synchronization policy
Initial synchronization
By default, you must select both Initial Schema Synchronization and Initial Full Data Synchronization. After the precheck is complete, DTS initializes the schema and data of the selected objects in the destination instance. This establishes the baseline for subsequent incremental synchronization.
Processing mode for existing target tables
-
Clear Target Table
Skips the Schema Name Conflict check item during the precheck phase. Clears the data in the destination table before full initialization. This is suitable for production synchronization after you complete testing the synchronization task.
-
Ignore Errors and Proceed
Skips the Schema Name Conflict check item during the precheck phase. During full data initialization, data is appended directly. This applies to data aggregation scenarios where data from multiple tables is synchronized into a single table.
Synchronization type
Select the operation types to synchronize based on your business requirements:
-
Insert
-
Update
-
Delete
-
AlterTable
Select synchronization objects
N/A
In the Source Objects box, select the tables to synchronize, and then click the > icon (
) to move them to the Selected Objects box.Note-
You can select objects only at the table level.
-
If you need the column names in the destination table to be different from those in the source table, use the field mapping feature of DTS. For more information, see Set object names in the destination instance.
Object name mapping
N/A
Change the names of synchronized objects in the destination instance. For more information, see Map databases, tables, and columns.
Replicate temporary tables during DMS online DDL operations
N/A
If you use Data Management (DMS) to perform online DDL changes on the source database, you can choose whether to synchronize the temporary tables generated by the DDL changes.
-
Yes: Synchronizes the temporary tables generated by online DDL changes.
NoteIf a large amount of temporary table data is generated by online DDL changes, the data synchronization task may be delayed.
-
No: Does not synchronize the temporary tables generated by online DDL changes. Only the original DDL operations from the source database are synchronized.
NoteThis option causes tables in the destination database to be locked.
Retry duration for failed connections
N/A
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.
-
-
Set the primary key and distribution columns for the synchronized tables in the AnalyticDB for PostgreSQL instance.
After you complete the settings, the Status column displays Defined. After you confirm the settings, click Pre-check and Start.
NoteThis page appears only if you selected Initial Schema Synchronization in the previous step. For more information about primary key and distribution columns, see Table constraints and Table distribution.
-
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 shows that Precheck Passed, close the Precheck dialog box. The synchronization task starts.
-
Wait for the task to complete initialization and enter the Synchronizing state.
You can view the status of the data synchronization task on the Data Synchronization page.