All Products
Search
Document Center

PolarDB:From a self-managed MySQL database connected over Express Connect, VPN Gateway, or Smart Access Gateway to a PolarDB for MySQL cluster

Last Updated:Mar 28, 2026

Use Data Transmission Service (DTS) to synchronize data from a self-managed MySQL database — connected to Alibaba Cloud over Express Connect, VPN Gateway, or Smart Access Gateway — to a PolarDB for MySQL cluster. DTS handles initial schema and full data synchronization, then keeps the destination cluster in sync with ongoing incremental changes.

Prerequisites

Before you begin, make sure you have:

Limitations

Review these limitations before configuring the synchronization task.

No primary key or unique constraint

The source database must have a PRIMARY KEY or UNIQUE constraint on all tables, with no duplicate field values. Without this, duplicate rows may appear in the destination cluster.

Triggers

If the source database contains a trigger that updates a table within the synchronized scope, data inconsistency may occur. See Configure a data synchronization task for a source database that contains a trigger for a resolution.

RENAME TABLE operations

RENAME TABLE may cause data inconsistency. If a table is selected as the synchronization object and then renamed during the task, data from that table stops syncing to the destination. To avoid this, select the entire database (rather than individual tables) as the synchronization object, and make sure all databases involved in the RENAME TABLE operation are included.

Online DDL tools (gh-ost and pt-online-schema-change)

Do not use gh-ost or pt-online-schema-change to run DDL operations during synchronization. These tools generate temporary tables in ways that DTS cannot handle, and the synchronization task may fail.

Tablespace growth after initial sync

Concurrent INSERT operations during initial full data synchronization cause table fragmentation. After the initial sync completes, the tablespace on the destination cluster will be larger than on the source database.

Performance impact during initial sync

DTS reads from and writes to both the source and destination instances during initial full data synchronization, which increases their load. On instances with low specifications or large data volumes, this can affect database availability. Run the synchronization task during off-peak hours — for example, when CPU utilization on both instances is below 30%.

Billing

Synchronization typeFee
Schema synchronization and full data synchronizationFree
Incremental data synchronizationCharged. See Billing overview.

Supported SQL operations

TypeOperations
DMLINSERT, UPDATE, DELETE, REPLACE
DDLALTER TABLE, ALTER VIEW, CREATE FUNCTION, CREATE INDEX, CREATE PROCEDURE, CREATE TABLE, CREATE VIEW, DROP INDEX, DROP TABLE, RENAME TABLE, TRUNCATE TABLE
Important

RENAME TABLE operations may cause data inconsistency between the source and destination. If you select individual tables as synchronization objects, renaming them stops their data from syncing. Select the parent database as the synchronization object instead, and include all databases involved before and after the rename.

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 details, see Synchronization topologies.

Set up the synchronization task

Step 1: Purchase a DTS instance

Purchase a DTS instance. On the buy page, set the following:

  • Source Instance: MySQL

  • Destination Instance: PolarDB

  • Synchronization Topology: One-Way Synchronization

Step 2: Configure source and destination instances

  1. Log on to the DTS console.

    If you are redirected to the Data Management (DMS) console, click the old icon in the image to return to the previous DTS console.
  2. In the left-side navigation pane, click Data Synchronization.

  3. At the top of the Synchronization Tasks page, select the region where the destination instance resides.

  4. Find the synchronization instance and click Configure Task in the Actions column.

  5. Configure the source and destination instances.

    Source Instance Details

    ParameterDescription
    Synchronization Task NameEnter a descriptive name. Task names do not need to be unique.
    Instance TypeSelect User-Created Database Connected Over Express Connect, VPN Gateway, or Smart Access Gateway.
    Instance RegionThe source region selected on the buy page. Read-only.
    Peer VPCThe ID of the VPC connected to the self-managed MySQL database.
    Database TypeSet to MySQL. Read-only.
    IP AddressThe server IP address of the self-managed MySQL database.
    Port NumberThe service port of the self-managed MySQL database.
    Database AccountThe account created on the source database (see Prerequisites).
    Database PasswordThe password for the database account.

    Destination Instance Details

    ParameterDescription
    Instance TypeSet to PolarDB. Read-only.
    Instance RegionThe destination region selected on the buy page. Read-only.
    PolarDB Instance IDThe ID of the destination PolarDB for MySQL cluster.
    Database AccountThe account on the destination cluster with ALL privileges on the objects to be synchronized.
    Database PasswordThe password for the database account.

    Configure the source and destination instances

  6. Click Set Whitelist and Next. DTS automatically adds its server CIDR blocks to the IP whitelist of Alibaba Cloud database instances (such as ApsaraDB RDS for MySQL) and to the security group rules of Elastic Compute Service (ECS) instances hosting self-managed databases. For self-managed databases in a data center or hosted by a third-party provider, add the CIDR blocks manually. See Add the CIDR blocks of DTS servers.

    Warning

    Adding DTS server CIDR blocks to your whitelist or security group rules introduces security risks. Before proceeding, take preventive measures such as using strong credentials, limiting exposed ports, auditing API calls, regularly reviewing your whitelist rules, and connecting the database to DTS by using Express Connect, VPN Gateway, or Smart Access Gateway.

Step 3: Select objects and configure conflict handling

Configure the following settings, then click Next.

SettingDescription
Processing mode for existing target tablesControls how DTS handles tables in the destination cluster that share names with source tables.
— Pre-check and InterceptDTS checks for name conflicts before starting. If the destination cluster already has tables with the same names, the precheck fails and the task cannot start. Use object name mapping to rename destination objects if needed.
— IgnoreDTS skips the name-conflict check. During initial sync, records with matching primary keys in the destination are not overwritten — but they are synchronized during incremental sync. If the source and destination schemas differ, initial sync may fail or only partially complete. Data consistency is not guaranteed with this option.
Objects to synchronizeIn the Available section, select tables or databases and click Rightwards arrow to move them to Selected. Selecting a database synchronizes all schema changes within it. Use object name mapping to rename objects in the destination.
Rename databases and tablesUse object name mapping to rename synchronized objects. See Object name mapping.
Sync DMS online DDL temporary tablesApplies if you use DMS for online DDL on the source. Yes syncs temporary tables (may cause task lag on large operations). No syncs only the original DDL, which may lock destination tables.
Retry time for failed connectionsDefault: 720 minutes (12 hours). DTS retries the connection within this window; if reconnected, the task resumes. If not, the task fails. DTS charges continue during the retry period — set this value based on your business needs.

Step 4: Select initial synchronization types

Select the synchronization types to run before incremental sync begins.

Advanced settings
  • Initial Schema Synchronization: Copies the schema from source to destination before data sync starts.

  • Initial Full Data Synchronization: Copies all existing data from source to destination.

Selecting both options synchronizes schemas and historical data before incremental synchronization begins.

Step 5: Run the precheck

Click Precheck. DTS validates the configuration before the task can start.

If any precheck item fails, click the 提示 icon next to it for details. Fix the issue and run a new precheck, or ignore the item and rerun if it is not critical.

After the Precheck Passed message appears, close the dialog. The synchronization task starts automatically.

Verify synchronization status

After initial synchronization completes, the task enters the Synchronizing state. Monitor task status on the Synchronization Tasks page.

View the status of a data synchronization task

What's next