This topic describes how to create a change tracking task to track data changes from a PolarDB-X V2.0 instance.

Prerequisites

  • A PolarDB-X V2.0 instance is created, and a database is created in this instance. For more information, see Create instances and Create a database.
    Note A database in a PolarDB-X instance must be created based on one or more ApsaraDB RDS for MySQL instances. Data Transmission Service (DTS) does not support PolarDB-X databases that are created based on PolarDB for MySQL clusters.
  • An ApsaraDB RDS for MySQL instance is created. For more information, see Create an ApsaraDB RDS for MySQL instance.

Limits

Category Description
Limits on the source database
  • The source tables must have PRIMARY KEY or UNIQUE constraints and all fields must be unique. Otherwise, part of the tracked data changes may be duplicate.
  • If you select tables as the objects to track, up to 500 tables can be tracked in a single change tracking task. If you run a task to track more than 500 tables, a request error occurs. In this case, we recommend that you split the tables and configure multiple tasks to track the tables, or configure a change tracking task for the entire database.
  • The following requirements for binary logs must be met:
    • The binary logging feature is enabled. The value of the binlog_row_image parameter is set to full. For more information, see Parameter settings. Otherwise, error messages are returned during precheck and the change tracking task cannot be started.

    • The binary logs of the source database are stored for more than 24 hours. Otherwise, DTS may fail to obtain the binary logs and the task may fail. In exceptional circumstances, data inconsistency or loss may occur. Make sure that you set the retention period of binary logs based on the preceding requirements. Otherwise, the Service Level Agreement (SLA) of DTS does not ensure service reliability or performance.
  • A read-only instance or temporary instance cannot be used as the source instance for change tracking.
Other limits
  • Limits on the objects for change tracking:
    • You can track data changes only at the table level.
      Note PolarDB-X V2.0 allows you to track the data changes of databases and tables.
    • After the change tracking task is configured, the objects for change tracking cannot be reselected. If you want to track the data changes of tables that are not included in the selected objects, you must create another change tracking task for the tables.
      Note This limit does not apply to PolarDB-X V2.0.
  • If you perform a primary/secondary switchover on the source instance when the change tracking task is running, the task fails.
  • When the change tracking task is running, do not scale in or out the source instance, migrate frequently-accessed tables, change shards, or perform DDL operations. Otherwise, the change tracking task fails or data inconsistency occurs.
  • If the source database is used in another task such as a running data migration task, DTS may track the data changes of other objects. In this case, you must manually filter the tracked data on the change tracking client.
  • You must make sure that the precision settings for columns of the FLOAT or DOUBLE data type meet your business requirements. DTS uses the ROUND(COLUMN,PRECISION) function to retrieve values from columns of the FLOAT or DOUBLE data type. If you do not specify a precision, DTS sets the precision for the FLOAT data type to 38 digits and the precision for the DOUBLE data type to 308 digits.
  • DTS does not track DDL operations that are performed by using gh-ost or pt-online-schema-change. Therefore, the change tracking client may fail to write the consumed data to the destination tables due to schema conflicts.

Permissions required for database accounts

Instance Required permission
Source PolarDB-X V2.0 instance Read permissions on the objects for change tracking

Procedure

  1. Go to the Change Tracking Tasks page.
    1. Log on to the Data Management (DMS) console.
    2. In the top navigation bar, click DTS.
    3. In the left-side navigation pane, choose DTS (DTS) > Change Tracking.
  2. To the right side of Change Tracking Tasks, select the region in which you want to create the change tracking task.
  3. Click Create Task. On the page that appears, configure the source database and the consumer network type.
    Warning After you select the source instance, we recommend that you read the limits displayed at the top of the page. This helps you create and run the change tracking task.
    Section Parameter Description
    N/A Task Name

    DTS automatically generates a task name. We recommend that you specify an informative name to identify the task. You do not need to use a unique task name.

    Source Database Select Template
    The instance to which the source database belongs. You can choose whether to use an existing instance based on your business requirements.
    • If you use an existing instance, DTS automatically applies the parameter settings of the source database.
    • If you do not use an existing instance, you must set parameters for the source database.
    Database Type The type of the source database. Select PolarDB-X 2.0.
    Access Method The method for accessing the source database. Set the value to Alibaba Cloud Instance.
    Instance Region The region in which the PolarDB-X V2.0 instance resides.
    Instance ID The ID of the PolarDB-X V2.0 instance.
    Database Account The database account that you use to log on to the PolarDB-X V2.0 instance. The account must have read permissions on the objects for change tracking.
    Database Password

    Enter the password of the database account.

    Consumer Network Type
    • Classic
    • VPC
    Select the network type of the change tracking instance.
    Note
    • If your change tracking client is deployed on a local server, you can select Classic or VPC.
    • If your change tracking client is deployed on an ECS instance, we recommend that you select the network of the ECS instance. For example, if the ECS instance is deployed in a VPC, select VPC as the network type and specify the VPC and vSwitch parameters.
    • If you track data changes over internal networks, the network latency is minimal.
    • Classic

      If you select Classic, no other configurations are required. For more information, see Classic network.

    • VPC

      If you select VPC, you must specify the VPC and vSwitch parameters. For more information, see VPCs.

    Notice After a change tracking task is configured, you cannot change the network type. Data changes are tracked and consumed over the specified type of network.
  4. In the lower part of the page, click Test Connectivity and Proceed.
  5. Select objects for the task and configure advanced settings.
    • Basic Settings
      Parameter Description
      Data Change Types
      • Data Update

        DTS tracks data updates of the selected objects, including the INSERT, DELETE, and UPDATE operations.

      • Schema Update

        DTS tracks the create, delete, and modify operations that are performed on all object schemas of the source instance. You must use the change tracking client to filter the required data.

      Source Objects
      Select one or more objects from the Source Objects section and click the Rightwards arrow icon to add the objects to the Selected Objects section.
      Note After the change tracking task is configured, the objects for change tracking cannot be reselected. If you want to track the data changes of tables that are not included in the selected objects, you must create another change tracking task for the tables.
    • Advanced Settings
      Parameter Description
      Set Alerts
      Specify whether to configure alerting for the change tracking task. If the task fails or the latency exceeds the specified threshold, the specified alert contacts can receive notifications. Valid values:
      • No: does not configure alerting.
      • Yes: configures alerting. In this case, you must also specify the alert threshold and alert contacts.
      Retry Time for Failed Connection
      The retry time range for failed connections. If the change tracking task fails, DTS immediately retries a connection within the time range. Valid values: 10 to 1440. Unit: minutes. Default value: 120. We recommend that you set the time range to more than 30 minutes. If DTS reconnects to the source instance within the specified time range, DTS resumes the change tracking task. Otherwise, the change tracking task fails.
      Note
      • If an instance serves as the source database of multiple change tracking tasks, the shortest retry time range that is set for the instance takes precedence.
      • When DTS retries a connection, you are charged for the DTS instance. We recommend that you specify the retry time range based on your business requirements. You can also release the DTS instance at your earliest opportunity after the source and destination instances are released.
      Configure ETL
      Specify whether to configure the extract, transform, and load (ETL) feature. For more information, see What is ETL? Valid values:
      • Yes: configures the ETL feature. You can enter your policy in the code editor.
      • No: does not configure the ETL feature.
  6. Click Next: Save Task Settings and Precheck in the lower part of the page.
    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.
      • You can troubleshoot the issues based on the causes and run a precheck again.
      • If you do not need to troubleshoot the issues, you can ignore failed items and run a precheck again.
  7. Wait until the Success Rate becomes 100%. Then, click Next: Purchase Instance.
  8. On the Purchase Instance page, specify the billing method of the change tracking instance. The following table describes the parameters.
    Parameter Description
    Billing Method
    • Subscription: You can pay for your subscription when you create an instance. We recommend that you select the subscription billing method for long-term use because it is more cost-effective than the pay-as-you-go billing method. You can save more costs with longer subscription periods.
    • Pay-as-you-go: A pay-as-you-go instance is billed on an hourly basis. We recommend that you select the pay-as-you-go billing method for short-term use. If you no longer require your pay-as-you-go instance, you can release it to reduce costs.
    Billing Type of Change Tracking Instance

    If you select the subscription billing method, you can select only USD 120 per month for configuration fee (no data traffic fee) as the billing type of the change tracking instance.

    Subscription Length
    If you select the subscription billing method, set the subscription length and the number of instances that you want to create. The subscription length can be one to nine months or one to three years.
    Note This parameter is available only if you select the subscription billing method.
    Note When a client accesses the change tracking instance over the Internet, DTS charges Internet traffic fee.
  9. Read and select Data Transmission Service (Pay-as-you-go) Service Terms.
  10. Click Buy and Start to start the change tracking task. You can view the progress of the task in the task list.

What to do next

When the change tracking task is running, you can create consumer groups based on the downstream client to consume the tracked data.
  1. Create and manage consumer groups. For more information, see Create consumer groups.
  2. Use one of the following methods to consume the tracked data: