Data Transmission Service (DTS) allows you to track data changes from databases in real time. You can use the change tracking feature in the following scenarios: lightweight cache updates, business decoupling and asynchronous data processing, and synchronization of extract, transform, and load (ETL) operations. This topic describes how to track data changes from a PolarDB-X 1.0 instance (formerly DRDS).

Prerequisites

A database is created in the PolarDB-X 1.0 instance based on one or more ApsaraDB RDS for MySQL instances, and the database version number is 5.5 or 5.6.
Note DTS does not support PolarDB-X 1.0 databases that are created based on PolarDB for MySQL clusters.

Precautions

  • A change tracking instance stores the data that was generated in the last 24 hours and deletes expired data.
  • When the change tracking task is running, do not scale the capacity of the PolarDB-X 1.0 instance, migrate frequently-accessed tables, change shard keys, or perform DDL operations on source objects. Otherwise, the change tracking task fails.
  • After the change tracking task is configured, you cannot reselect the objects for change tracking. For more information, see Modify objects for change tracking.
  • You can only track data changes of specific tables.
  • You cannot track the schema updates of the source instance.

Procedure

  1. Create a change tracking instance. For more information, see Purchase a DTS instance.
    Note On the buy page, set Instance Type to PolarDB-X (formerly DRDS).
  2. Log on to the DTS console.
  3. In the left-side navigation pane, click Change Tracking.
  4. In the upper part of the Change Tracking Tasks page, select the region where the change tracking instance resides.
  5. Find the change tracking instance and click Configure Task in the Actions column.
  6. Configure the source database for the change tracking task.
    Configure the source database
    Section Parameter Description
    N/A Task Name The task name that DTS automatically generates. We recommend that you specify a descriptive name that makes it easy to identify the task. You do not need to use a unique task name.
    Source Database Instance Type Select DRDS Instance.
    Database Type The value of this parameter is set to DRDS and cannot be changed.
    Instance Region The source region that you selected on the buy page. The value of this parameter cannot be changed.
    DRDS Instance ID The ID of the source PolarDB-X 1.0 instance.
    Database Name The name of the database from which you want to track data changes.
    Database Account The database account of the source PolarDB-X 1.0 instance.
    Database Password The password of the database account.
  7. In the lower-right corner of the page, click Set Whitelist and Next.
    Warning
    • If the source or destination database instance is an Alibaba Cloud database instance, such as an ApsaraDB RDS for MySQL or ApsaraDB for MongoDB instance, or is a self-managed database hosted on Elastic Compute Service (ECS), DTS automatically adds the CIDR blocks of DTS servers to the whitelist of the database instance or ECS security group rules. For more information, see Add the CIDR blocks of DTS servers to the security settings of on-premises databases. If the source or destination database is a self-managed database on data centers or is from other cloud service providers, you must manually add the CIDR blocks of DTS servers to allow DTS to access the database.
    • If the CIDR blocks of DTS servers are automatically or manually added to the whitelist of the database instance or ECS security group rules, security risks may arise. Therefore, before you use DTS to migrate data, you must understand and acknowledge the potential risks and take preventive measures, including but not limited to the following measures: enhance the security of your account and password, limit the ports that are exposed, authenticate API calls, regularly check the whitelist or ECS security group rules and forbid unauthorized CIDR blocks, or connect the database to DTS by using Express Connect, VPN Gateway, or Smart Access Gateway.
    • After your DTS task is completed or released, we recommend that you manually detect and remove the added CIDR blocks from the whitelist of the database instance or ECS security group rules.
  8. Select the data change types and objects.
    Select the data change types and objects
    Parameter Description
    Required Data Types The data change types that you want to track. You can select only Data Updates. DTS tracks data updates of the objects that you select. Data updates include the INSERT, DELETE, and UPDATE operations.
    Required Objects The objects for change tracking. Select one or more objects from the Required Objects section and click the Rightwards arrow icon to add the objects to the Selected section.
    Note
    • You can select tables as the objects for change tracking. Databases cannot be selected as the objects for change tracking.
    • After the change tracking task is configured, the objects for change tracking cannot be modified. If you want to track data changes of tables that are not included in the selected objects, you must create another change tracking task for the tables.
  9. In the lower-right corner of the page, click Save and Precheck.
    Note
    • Before you can start the change tracking task, DTS performs a precheck. You can start the change tracking task only after the task passes the precheck.
    • If the task fails to pass the precheck, you can click the Info icon icon next to each failed item to view details. After you troubleshoot the issues based on the causes, you can run a precheck again.
  10. Close the Precheck dialog box after the following message is displayed: Precheck Passed.

What to do next

After the change tracking task is configured, DTS performs initial change tracking. After initial change tracking is complete, you can consume the tracked data. For more information, see Use the SDK demo code to consume tracked data.