Use Data Transmission Service (DTS) to continuously synchronize data from a PolarDB for MySQL cluster to a PolarDB-X 1.0 instance. DTS supports both full data synchronization and ongoing incremental synchronization with minimal impact on the source database.
Prerequisites
Before you begin, make sure that you have:
-
A PolarDB-X 1.0 instance with available storage larger than the total data size in the source PolarDB for MySQL cluster. When creating the instance, select RDS MySQL as the storage type. See Create a PolarDB-X 1.0 instance
-
Databases and tables pre-created in the destination instance. DTS synchronizes data only, not schema. See Create a databaseCreate a database and Basic SQL operations
-
A database account on the source PolarDB for MySQL cluster with read and write permissions. See Create and manage a database account
-
A database account on the destination PolarDB-X 1.0 instance with read and write permissions. See Manage database accounts
Billing
| Synchronization type | Fee |
|---|---|
| Full data synchronization | Free |
| Incremental data synchronization | Charged. See Billing overview |
Limitations
Source database requirements
-
Tables must have a primary key or UNIQUE constraint, with all fields unique. Without this, the destination may contain duplicate records.
-
If you rename tables or columns at the destination, a single task supports up to 1,000 tables. For more than 1,000 tables, split into multiple tasks or sync at the database level instead.
-
DTS does not sync the following data types: BIT, VARBIT, GEOMETRY, ARRAY, UUID, TSQUERY, TSVECTOR, and TXID_SNAPSHOT.
-
DTS does not sync prefix indexes. If the source has prefix indexes, the task may fail.
-
DTS does not sync read-only nodes or Object Storage Service (OSS) external tables from the source cluster.
Requirements for incremental synchronization
Binary logging must be enabled on the source cluster and the loose_polar_log_bin parameter must be set to on. Without this, the precheck fails and the task cannot start. See Enable binary logging and Modify parameters.
Enabling binary logging incurs storage charges for the space used by binary logs.
Binary log retention requirements:
| Task type | Minimum retention period |
|---|---|
| Incremental data synchronization only | 24 hours |
| Full + incremental data synchronization | 7 days |
If binary logs are not retained for the required period, DTS may fail to obtain them and the task may fail — which can cause data inconsistency or loss. After full synchronization completes, you can set the retention period to more than 24 hours.
Incremental synchronization supports the following DML operations: INSERT, UPDATE, and DELETE.
DDL operation constraints
| Operation | During full synchronization | During incremental synchronization |
|---|---|---|
| DDL on source tables | Not supported — causes task failure | Supported only via DMS lock-free DDL (see note below) |
| pt-online-schema-change DDL | Not supported — causes task failure | Not supported — causes task failure |
| Schema synchronization | Not supported | Not supported |
You can use Data Management (DMS) to perform lock-free DDL operations on source tables during data synchronization, but only if no other sources are writing to the destination database at the same time. If other sources are also writing to the destination while you run DMS online DDL statements, data loss may occur. See Perform lock-free DDL operations.
Operational constraints
-
Sync during off-peak hours. Full data synchronization consumes read and write resources on both source and destination databases, which increases server load.
-
After full data synchronization completes, the destination tablespace is larger than the source due to fragmentation from concurrent INSERT operations.
-
If a DTS task fails, DTS support will try to restore it within 8 hours. The task may be restarted during restoration, and task parameters (not database parameters) may be modified.
DTS periodically executes CREATE DATABASE IF NOT EXISTS test on the source database to advance the binary log position.
Configure the synchronization task
Step 1: Open the Data Synchronization page
Use either the DTS console or the DMS console.
DTS console
-
Log on to the DTS console.DTS console
-
In the left-side navigation pane, click Data Synchronization.
-
In the upper-left corner, select the region where the synchronization instance resides.
DMS console
The actual operations may vary based on the mode and layout of the DMS console. For more information, see Simple mode and Customize the layout and style of the DMS console.
-
Log on to the DMS console.DMS console
-
In the top navigation bar, move the pointer over Data + AI and choose DTS (DTS) > Data Synchronization.
-
From the drop-down list next to Data Synchronization Tasks, select the region where the synchronization instance resides.
Step 2: Create a task
-
Click Create Task.
-
If the page shows a New Configuration Page button in the upper-right corner, click it to switch to the new configuration page. Skip this step if Back to Previous Version is shown instead.
Step 3: Configure source and destination databases
Configure the following parameters:
| Section | Parameter | Value |
|---|---|---|
| N/A | Task Name | Enter a descriptive name. No uniqueness requirement. |
| Source Database | Select a DMS database instance | Select an existing registered database, or leave blank and fill in the fields below. |
| Database Type | PolarDB for MySQL | |
| Access Method | Alibaba Cloud Instance | |
| Instance Region | The region of the source PolarDB for MySQL cluster. | |
| Replicate Data Across Alibaba Cloud Accounts | No | |
| PolarDB Cluster ID | The ID of the source cluster. | |
| Database Account | The database account with the required permissions. | |
| Database Password | The password for the account. | |
| Encryption | Configure based on your security requirements. See Configure SSL encryption. | |
| Destination Database | Select a DMS database instance | Select an existing registered database, or leave blank and fill in the fields below. |
| Database Type | PolarDB-X 1.0 | |
| Access Method | Alibaba Cloud Instance | |
| Instance Region | The region of the destination PolarDB-X 1.0 instance. | |
| Instance ID | The ID of the destination instance. | |
| Database Account | The database account with the required permissions. | |
| Database Password | The password for the account. |
To register a database:
In the DMS console, click Add DMS Database Instance. See Register an Alibaba Cloud database instance and Register a database hosted on a third-party cloud service or a self-managed database.
In the DTS console, register on the Database Connections page. See Manage database connections.
Step 4: Test connectivity
Click Test Connectivity and Proceed.
DTS automatically adds its server CIDR blocks to the whitelist of Alibaba Cloud database instances and to the security group rules of Elastic Compute Service (ECS) instances. For self-managed databases in data centers or on third-party clouds, manually add the CIDR blocks. See CIDR blocks of DTS servers.
Adding DTS server CIDR blocks to your whitelist or security group rules introduces security risks. Before proceeding, take preventive measures: strengthen account credentials, limit exposed ports, authenticate API calls, and regularly audit your whitelist and security group rules. Alternatively, connect DTS to your database through Express Connect, VPN Gateway, or Smart Access Gateway (SAG).
Step 5: Configure objects to synchronize
In the Configure Objects step, set the following parameters.
Synchronization types
| Type | What it does | When to use |
|---|---|---|
| Full Data Synchronization | Copies all existing data from the source to the destination. This data serves as the baseline for subsequent incremental synchronization. | Select this to start with a historical copy of your data. |
| Incremental Data Synchronization | Continuously applies ongoing changes (INSERT, UPDATE, DELETE) from the source to the destination. Selected by default. | Select this to keep the destination in sync with the source after full synchronization. |
Schema synchronization is not supported and cannot be selected.
Processing mode for conflicting tables
| Mode | Behavior |
|---|---|
| Precheck and Report Errors | Checks for tables in the destination with the same names as source tables before starting. If duplicates exist, the precheck fails and the task does not start. Use object name mapping to rename destination tables if they cannot be deleted or renamed. |
| Ignore Errors and Proceed | Skips the duplicate table name check. During full synchronization, existing records with matching primary or unique key values in the destination are retained (not overwritten). During incremental synchronization, those records are overwritten. If schemas differ, initialization may partially fail. |
Ignore Errors and Proceed can cause data inconsistency. Use with caution.
Capitalization of object names in destination instance
Controls the casing of database names, table names, and column names in the destination. Default is DTS default policy. See Specify the capitalization of object names in the destination instance.
Selecting objects
In the Source Objects section, select the tables to synchronize and click
to move them to Selected Objects. Only tables can be selected as synchronization objects.
To rename objects in the destination:
-
Single object: right-click the object in Selected Objects. See Map the name of a single object.
-
Multiple objects: click Batch Edit in the upper-right corner of Selected Objects. See Map multiple object names at a time.
To filter rows in a table, right-click the table in Selected Objects and configure filter conditions. See Set filter conditions.
Renaming an object with the object name mapping feature may cause other objects that depend on it to fail synchronization.
Step 6: Configure advanced settings
Click Next: Advanced Settings and configure the following:
| Parameter | Description |
|---|---|
| Dedicated Cluster for Task Scheduling | By default, the task runs on the shared cluster. To improve stability, purchase a dedicated cluster. See What is a DTS dedicated cluster. |
| Retry Time for Failed Connections | How long DTS retries after a failed connection. Range: 10–1,440 minutes. Default: 720. Set to at least 30 minutes. If multiple tasks share the same source or destination, the shortest retry time applies. |
| Retry Time for Other Issues | How long DTS retries after failed DDL or DML operations. Range: 1–1,440 minutes. Default: 10. Set to at least 10 minutes. Must be less than Retry Time for Failed Connections. |
| Enable Throttling for Full Data Migration | Limits QPS to the source, RPS, and migration speed (MB/s) during full synchronization to reduce destination server load. Visible only when Full Data Synchronization is selected. |
| Enable Throttling for Incremental Data Synchronization | Limits RPS and sync speed (MB/s) during incremental synchronization to reduce destination server load. |
| Environment Tag | An optional tag to identify the DTS instance. |
| Whether to delete SQL operations on heartbeat tables of forward and reverse tasks | Controls whether DTS writes heartbeat SQL to the source database. Yesalert notification settings avoids writing heartbeat SQL (a latency indicator may be shown). No writes heartbeat SQL (may affect physical backup and cloning). |
| Configure ETL | Enables extract, transform, and load (ETL) processing. Select Yes to enter data processing statements. See Configure ETL in a data migration or data synchronization task. |
| Monitoring and Alerting | Sends notifications when the task fails or synchronization latency exceeds a threshold. Select Yes to configure alert thresholds and contacts. See Configure monitoring and alerting when you create a DTS task. |
While DTS retries a connection, you are still charged for the DTS instance. Release the instance promptly after both source and destination instances are released.
Step 7: Run the precheck
Click Next: Save Task Settings and Precheck.
To preview the OpenAPI parameters for this task, hover over the button and click Preview OpenAPI parameters before proceeding.
DTS runs a precheck before starting the task. The task only starts after passing.
-
If any check item fails, click View Details next to the failed item, fix the issue, and click Precheck Again.
-
If a check item triggers an alert that can be ignored, click Confirm Alert Details > Ignore > OK, then click Precheck Again. Ignoring alerts may cause data inconsistency.
Wait until the Success Rate reaches 100%, then click Next: Purchase Instance.
Step 8: Purchase the synchronization instance
On the buy page, configure the instance:
| Section | Parameter | Description |
|---|---|---|
| New Instance Class | Billing Method | Subscription: Pay upfront. More cost-effective for long-term use. Durations: 1–9 months, or 1, 2, 3, or 5 years. Pay-as-you-go: Billed hourly. Suitable for short-term use. Release the instance when no longer needed to stop charges. |
| Instance Class | Select based on your required synchronization speed. See Instance classes of data synchronization instances. | |
| Resource Group Settings | — | The resource group for the instance. Default: default resource group. See What is Resource Management? |
| Subscription Duration | — | Available only for the subscription billing method. |
Read and select Data Transmission Service (Pay-as-you-go) Service Terms, then click Buy and Start. In the confirmation dialog box, click OK.
The task appears in the task list. Monitor its progress there.