You can use Data Transmission Service (DTS) 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, asynchronous data processing, and synchronization of extract, transform, and load (ETL) operations. This topic describes how to create a change tracking task to track data changes from an ApsaraDB RDS for MySQL instance.
- An internal endpoint is configured for the ApsaraDB RDS for MySQL instance.
- MySQL 5.5, 5.6, 5.7, or 8.0 is run on the ApsaraDB RDS for MySQL instance.
- The source ApsaraDB RDS for MySQL instance is created. For more information, see Create an ApsaraDB RDS for MySQL instance.
|Limits on the source database||
- Go to the Change Tracking Tasks page.
- Log on to the Data Management (DMS) console.
- In the top navigation bar, click DTS.
- In the left-side navigation pane, choose .
- If you log on to the DMS console and click the Enter Simple Mode icon in the upper-right corner, you can move the pointer over the icon in the upper-left corner, and then choose Configure the DMS console based on your business requirements. . For more information, see
- You can also configure the settings by using the new DTS console.
- To the right of Change Tracking Tasks, select the region in which you want to create the change tracking task. Note If you use the new DTS console, you must select the region from the drop-down list to the right of Workbench on the Change Tracking Tasks page of the DTS console.
- 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 in the upper part of the page. This helps you create and run the change tracking task.
Section Parameter Description None 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 Select InstanceSelect whether to use an existing instance.
- If you use an existing instance, DTS automatically applies the parameter settings of the instance.
- If you do not use an existing instance, you must configure the following parameters.
Database Type The type of the source database. Select MySQL. Access Method The service that is used to access the source database. Select Alibaba Cloud Instance. Instance Region The region in which the ApsaraDB RDS for MySQL instance resides. Replicate Data Across Alibaba Cloud Accounts Specifies whether data is migrated across Alibaba Cloud accounts. In this example, No is selected because data is migrated within the same Alibaba Cloud account. RDS Instance ID The ID of the ApsaraDB RDS for MySQL instance. Database Account The account of the source database. Enter a database account that has read-only permissions on the ApsaraDB RDS for MySQL instance, or a custom account that has the REPLICATION CLIENT, REPLICATION SLAVE, SHOW VIEW, and SELECT permissions. Database Password
The password of the database account.
Select Non-encrypted or SSL-encrypted based on your business requirements. If you want to select SSL-encrypted, you must enable SSL encryption for the source instance before you configure the change tracking task. For more information, see Configure SSL encryption for an ApsaraDB RDS for MySQL instance.
Consumer Network Type Network TypeThe Network Type parameter is set to VPC. You must select a VPC and a vSwitch. For more information, see VPCs.Note
- After the task is created, you cannot change the settings in the Consumer Network Type section.
- If your change tracking client is deployed in a VPC, we recommend that you select the same VPC and vSwitch as the client.
- If you track data changes over internal networks, the network latency is minimal.
- In the lower part of the page, click Test Connectivity and Proceed. 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 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, Alibaba Cloud 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: enhancing the security of your username and password, limiting the ports that are exposed, authenticating API calls, regularly checking the whitelist or ECS security group rules and forbidding unauthorized CIDR blocks, or connecting the database to DTS by using Express Connect, VPN Gateway, or Smart Access Gateway.
- After the DTS task is complete or released, we recommend that you manually detect and remove the added CIDR blocks from the whitelist of the database, Alibaba Cloud database instance, or ECS security group rules.
- 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 Updates
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 ObjectsSelect one or more objects from the Source Objects section and click the icon to add the objects to the Selected Objects section.Note You can select tables or databases as the objects for change tracking.
- If you select a database as the object, DTS tracks data changes of all objects, including new objects in the database.
- If you select a table as the object, DTS tracks only data changes of this table. In this case, if you want to track data changes of another table, you must add the table to the selected objects. For more information, see Modify the objects for change tracking.
- Data Update
- Advanced Settings
Parameter Description Set AlertsSelect whether to set alerts for the change tracking task. If the task fails or the latency exceeds the threshold, the alert contacts will receive notifications. Valid values:
- No: does not set alerts.
- Yes: sets alerts. In this case, you must also set the alert threshold and alert contacts.
Retry Time for Failed ConnectionsThe retry time for failed connections. Valid values: 10 to 1440. Unit: minutes. Default value: 120. We recommend that you set the retry time to more than 30 minutes. If DTS reconnects to the source and destination databases within the specified time, 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 less value of this parameter 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 ETLSpecify whether you want to enable the ETL feature. For more information, see What is ETL?.
- If you select Yes, the ETL feature is enabled. You must specify a policy in the text box.
- If you select No, the ETL feature is disabled.
- Basic Settings
- 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, click the icon next to each failed item to view details.
- After you troubleshoot the issues based on the causes, run a precheck again.
- If you do not need to troubleshoot the issues, ignore failed items and run a precheck again.
- Wait until the Success Rate becomes 100%. Then, click Next: Purchase Instance.
- 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 pay for the instance when you create an instance. The subscription billing method is more cost-effective than the pay-as-you-go billing method for long-term use.
- Pay-as-you-go: A pay-as-you-go instance is billed on an hourly basis. The pay-as-you-go billing method is suitable for short-term use. If you no longer require a pay-as-you-go instance, you can release the pay-as-you-go instance to reduce costs.
Billing Type of Change Tracking Instance
If you select the subscription billing method, you can select only Full-price Configuration Fee (No Data Traffic Fee) as Billing Type of Change Tracking Instance.
Subscription LengthIf you select the subscription billing method, set the subscription duration and the number of instances that you want to create. The subscription duration can be one to nine months or one to three years.Note This parameter is available only if you select the subscription billing method.
- Read and select Data Transmission Service (Pay-as-you-go) Service Terms.
- Click Buy and Start to start the change tracking task. You can view the progress of the task in the task list.