tencent cloud


Data Sync Overview

Last updated: 2022-09-02 18:22:41

    Feature overview

    The data sync feature refers to real-time data sync between two database sources. It is suitable for cloud-local active-active, multi-site active-active, and cross-border data sync as well as real-time data warehousing.

    Unlike data migration which is a one-time short-term task to migrate the entire database, data sync is a continuous task. After a task is created, the data will be continuously synced (almost in real time) to keep consistency between the source and target databases.

    How it works

    The following takes MySQL sync as an example to describe the data sync feature, where data is exported from the source database and imported into the target database, and key steps include structure initialization, full data initialization, and incremental data processing.

    • Structure initialization
      Structure initialization is to create the same table structure information in the target database as that in the source database. When configuring a sync task, you can select whether to sync the table structure. If the target database already contains the same structural information, you simply need to sync the data; otherwise, you'll need to sync the information as well.

    • Full data initialization
      After structure initialization is completed, DTS will initialize the existing data, i.e., exporting all existing data from the source database and import it into the target database.

    • Incremental data processing
      In incremental data processing, DTS gets the incremental data continuously through the source database's binlog and persistently stores such data in the intermediate storage after a series filtering and conversion operations. After importing the full data, it continuously replays the changed incremental data stored in the intermediate storage into the target database in order to ensure data consistency between the source and target databases.

    Supported topologies

    The basic unit of the sync service is one-way sync. During configuration, you can choose to use data definition language (DDL) or data manipulation language (DML) for sync. By combining one-way sync tasks, you can customize various complex topologies.
    In a complex topology, technical measures will be used for DML operations to avoid data loop. However, for DDL, the data sync service will check for loop during configuration to avoid forming DDL loop.

    Below are some common topologies, which you can customize by purchasing multiple sync instances:

    • One-to-One one-way sync
    • Cascaded one-way sync
    • One-to-Many one-way sync
    • Many-to-One one-way sync
    • Two-Way sync
    • Cascaded two-way sync

    Typical use cases

    By using DTS, you can sync data between MySQL databases in multiple regions to implement multi-site active-active deployment. Database instances in each region can run in the cloud or your self-built IDC.


    You can implement two-way sync by combining one-way sync tasks, but the following restrictions exist:

    • Your business should cooperate in terms of data consistency, i.e., ensuring that data with the same primary key is updated only on the same node.
    • If a data sync conflict occurs, DTS will process the data strictly according to the selected conflict processing policy. You need to confirm whether the corresponding policy meets your business expectation during configuration.
    • DML statements support two-way sync, but DDL statements support only one-way sync. To create two-way sync, ensure that DDL sync is disabled in one of the one-way instances.

    Supported database types

    For more information on the source and target database types, versions, and sync types supported for data sync, see Databases Supported by Data Sync.

    Supported advanced features

    Feature Description Documentation
    Two-way sync, ring sync, and many-to-one sync Complex sync topologies such as two-way sync, ring sync, and many-to-one sync are supported. Databases Supported by Data Sync
    Cross-account sync Data sync between instances under different Tencent Cloud accounts is supported. Cross-account TencentDB Instance Sync
    Cross-version sync of most databases The target database version should be equal to or later than the source database version; for example, data on v5.5.x can be synced to v5.5.x, v5.6.x, or later. The last digit in the version number is the minor version number, which is not restricted. -
    Table conflict check The duplicate table name check policy is provided. -
    Primary key conflict check The following three primary key conflict processing policies are supported:
  • Report: If a primary key conflict of tables is found during data sync, it will report an error and pause the data sync task.
  • Ignore: If a primary key conflict is found during data sync, it will keep the primary key record in the target database.
  • Overwrite: If a primary key conflict is found during data sync, it will use the primary key record in the source database to overwrite that in the target database.
  • -
    DML and DDL filtering
  • You can select the data types to be synced, such as INSERT, UPDATE, and DELETE statements.
  • You can select the specific DDL operation, such as CREATE TABLE, CREATE VIEW, and DROP INDEX.
  • Setting SQL Sync Policy
    WHERE conditional filter You can customize a filter for a single table. Setting SQL Sync Policy
    Sync of views and advanced objects Views, stored procedures, functions, triggers, and events can be synced. -
    Task progress visualization Information such as sync steps and progress can be displayed. -
    Metric monitoring and default alarm policy
  • Data sync metrics can be monitored.
  • Default configuration is supported for data sync event monitoring to automatically notify you of abnormal events.
  • Supported Events and Metrics
    Database restart or upgrade During incremental data sync, the source and target databases can be restarted or upgraded. -
    HA switch
  • HA switch of the source database is supported if GTID is enabled.
  • HA switch of the target database is supported.
  • -
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support