Data Transmission Service (DTS) captures data changes from a source database in real time and delivers them to downstream consumers. This topic describes how to create a change tracking task for an ApsaraDB RDS for MySQL instance on a DTS dedicated cluster.
Typical use cases include cache updates, asynchronous business decoupling, synchronization between heterogeneous data sources, and extract, transform, and load (ETL) pipelines.
Prerequisites
Before you begin, make sure you have:
A DTS dedicated cluster. See Create a DTS dedicated cluster.
A source ApsaraDB RDS for MySQL instance. See Create an ApsaraDB RDS for MySQL instance.
A database account on the source instance with read-only permissions, or a custom account with the REPLICATION CLIENT, REPLICATION SLAVE, SHOW VIEW, and SELECT permissions.
Binary log settings that meet DTS requirements (check before starting):
Setting Required value binlog_row_imagefull— see View RDS instance parametersBinary log retention More than 24 hours
Limitations
Source database requirements
| Requirement | Details |
|---|---|
| Primary key or unique constraint | Source tables must have PRIMARY KEY or UNIQUE constraints with all fields unique. Without them, DTS may produce duplicate change records. |
| Table limit per task | A single change tracking task can track up to 500 tables. If you need to track more, use multiple tasks or track the entire database instead. |
binlog_row_image | Must be set to full. If it is not, the precheck fails and the task cannot start. |
| Binary log retention | Logs must be retained for more than 24 hours. Shorter retention may cause DTS to fail to read logs, resulting in data inconsistency or loss, and may void the DTS Service Level Agreement (SLA) guarantees. |
| Instance type | Read-only instances and temporary instances cannot be used as the source. |
Other limitations
| Limitation | Details |
|---|---|
| FLOAT/DOUBLE precision | DTS uses ROUND(COLUMN, PRECISION) to read values from FLOAT and DOUBLE columns. If you do not specify precision, DTS defaults to 38 digits for FLOAT and 308 digits for DOUBLE. Verify that these defaults meet your requirements. |
| gh-ost and pt-online-schema-change | DTS does not track DDL operations performed by gh-ost or pt-online-schema-change. Schema changes made by these tools can cause conflicts when the change tracking client writes to the destination. |
Create a change tracking task
The task wizard has the following stages:
| Stage | What you configure |
|---|---|
| 1. Source database and consumer network | Connection details, network type |
| 2. Objects and change types | Tables or databases to track, DML/DDL scope |
| 3. Advanced settings | Alerts, retry timeouts |
| 4. Precheck | Automated validation |
| 5. Instance class | DTS unit allocation |
Step 1: Open the task configuration page
Go to the Dedicated Cluster page.
In the top navigation bar, select the region where your DTS dedicated cluster is located.
Find the target cluster. In the Actions column, choose Configure Task > Configure Change Tracking Task.
Step 2: Configure the source database
After selecting a source instance, read the limits shown at the top of the page before proceeding.
| Parameter | Description |
|---|---|
| Task Name | DTS auto-generates a name. Provide a descriptive name to identify the task. The name does not need to be unique. |
| Select an existing database connection (optional) | Select a saved connection to have DTS apply its settings automatically. Leave blank to configure the database manually. |
| Database Type | Select MySQL. |
| Access Method | Select Alibaba Cloud Instance. |
| Instance Region | Pre-filled based on the dedicated cluster region. Cannot be changed. |
| Replicate Data Across Alibaba Cloud Accounts | Select No. |
| RDS Instance ID | Select the source ApsaraDB RDS for MySQL instance. |
| Database Account | Enter the database account. |
| Database Password | Enter the account password. |
| Encryption | Select Non-encrypted or SSL-encrypted. For SSL encryption, enable SSL on the source instance before configuring this task. |
Step 3: Configure the consumer network type
| Parameter | Description |
|---|---|
| Network Type | Only Virtual Private Cloud (VPC) is supported. Select a VPC and a vSwitch. |
The network type cannot be changed after the task is created. All change data must be consumed over the specified network.
Click Test Connectivity and Proceed.
DTS adds its CIDR blocks to your database security settings to establish connectivity:
Alibaba Cloud database instances (such as ApsaraDB RDS for MySQL): DTS adds its CIDR blocks to the instance whitelist automatically.
Self-managed databases on ECS: DTS adds its CIDR blocks to the ECS security group automatically. You must also add them to the database's own security settings.
Self-managed databases in data centers or on third-party clouds: Add DTS CIDR blocks to the database security settings manually.
These whitelist changes introduce potential security exposure. To reduce risk: use strong credentials, limit exposed ports, authenticate API calls, and review whitelist and ECS security group rules regularly. Consider connecting the database to DTS through Express Connect, VPN Gateway, or Smart Access Gateway. After the task is released, remove the DTS CIDR blocks from the whitelist and security group rules.
Step 4: Select objects and change types
| Parameter | Description |
|---|---|
| Data Change Types | Data Update: tracks INSERT, DELETE, and UPDATE operations on the selected objects. Schema Updates: tracks CREATE, DROP, and ALTER operations on all schemas in the source instance. If you enable Schema Updates, use the change tracking client to filter only the schemas you need. |
| Source Objects | Select tables or databases, then click the rightwards arrow icon to move them to Selected Objects. Selecting a database tracks all current and future objects in it. Selecting individual tables tracks only those tables — add new tables manually as needed. See Modify the objects for change tracking. |
Click Next: Advanced Settings.
Step 5: Configure advanced settings
| Parameter | Description |
|---|---|
| Select the dedicated cluster used to schedule the task | Your DTS dedicated cluster is selected by default. |
| Set Alerts | Select Yes to receive notifications when the task fails or latency exceeds a threshold. Specify the alert threshold and alert contacts. See Configure monitoring and alerting when you create a DTS task. |
| Retry Time for Failed Connections | How long DTS retries after a connection failure. Range: 10–1,440 minutes. Default: 720. Set to greater than 30 minutes. If multiple tasks share the same source database, the most recently configured value takes effect. DTS charges apply during retries. |
| Wait time before a retry when other issues occur | How long DTS waits before retrying after DDL or DML failures. Range: 1–1,440 minutes. Default: 10. Set to greater than 10 minutes. This value must be less than Retry Time for Failed Connections. |
Click Next: Save Task Settings and Precheck.
Step 6: Pass the precheck
DTS runs a precheck before the task can start. Wait for the precheck to complete.
If all items pass, the success rate reaches 100%.
If any item fails, click the info icon next to it for details. Fix the issue and rerun the precheck, or ignore the item if it is not blocking and rerun.
Click Next: Select DTS Instance Type.
Step 7: Set the instance class and start the task
In the New Instance Class section, configure the instance class. The minimum is 1 DTS unit (DU); the maximum is the number of remaining available DUs on the dedicated cluster.
Read and accept the Data Transmission Service (Pay-as-you-go) Service Terms.
Click Start Task.
To monitor progress, go to the cluster details page and click Cluster Task List in the left-side navigation pane.
What's next
After the change tracking task is running, set up downstream consumers to receive the change data:
Create consumer groups. See Create consumer groups.
Consume the tracked data using one of the following methods: