Data Transmission Service (DTS) lets you synchronize data from PolarDB-X 2.0 to Tablestore.
Prerequisites
A Tablestore instance is created. For more information, see Create an instance.
The AccessKey ID and AccessKey secret of the Alibaba Cloud account that owns the Tablestore instance are obtained. For more information, see Create an AccessKey.
Precautions
Type | Description |
Source database limits |
|
Other limits |
|
SQL operations that can be incrementally synchronized
| Operation type | SQL statement |
|---|---|
| DML | INSERT, UPDATE, DELETE |
Procedure
Go to the list of synchronization tasks.
Log on to the Data Management (DMS) console.
Click Integration & Development in the top menu bar.
In the left navigation pane, choose .
To the right of Sync Tasks, select the region where the data synchronization instance is located.
NoteThe actual operations may vary depending on the mode and layout of the DMS console. For more information, see Simple mode console and Customize the layout and style of the DMS console.
You can also log on to the new DTS console to manage synchronization tasks.
Click Create Task to open the task configuration page.
Optional: In the upper-right corner, click New Configuration Page.
NoteIf the button in the upper-right corner of the new configuration page is Back to Previous Version, you can skip this step.
Some parameters on the new configuration page are different from those on the old configuration page. We recommend that you use the new configuration page.
Configure the source and destination databases.
Category
Configuration
Description
None
Task Name
DTS automatically generates a task name. We recommend that you specify a descriptive name for easy identification. The name does not need to be unique.
Source Database
Select an existing DMS database instance. (Optional. If you have not registered a DMS database instance, ignore this option and configure database settings in the section below.)
Choose whether to use an existing instance as needed.
If you use an existing instance, the database information is automatically filled in. You do not need to enter it again.
If you do not use an existing instance, enter the database information below.
Database Type
Select PolarDB-X 2.0.
Access Method
Select Alibaba Cloud Instance.
Instance Region
Select the region where the source PolarDB-X 2.0 instance is located.
Replicate Data Across Alibaba Cloud Accounts
This example shows how to synchronize data within the same Alibaba Cloud account. Select No. For information about cross-account scenarios, see Configure a task for cross-account data synchronization.
Instance ID
Select the ID of the source PolarDB-X 2.0 instance.
Database Account
Enter the database account of the source PolarDB-X 2.0 instance. The account must have the REPLICATION SLAVE, REPLICATION CLIENT, and SELECT permissions on the objects to be synchronized.
NoteFor more information about how to grant permissions, see Manage database accounts and Account permission issues during data synchronization.
Database Password
Enter the password for the specified database account.
Destination Database
Select an existing DMS database instance. (Optional. If you have not registered a DMS database instance, ignore this option and configure database settings in the section below.)
Choose whether to use an existing instance as needed.
If you use an existing instance, the database information is automatically filled in. You do not need to enter it again.
If you do not use an existing instance, enter the database information below.
Database Type
Select Tablestore.
Access Method
Select Alibaba Cloud Instance.
Instance Region
Select the region where the destination Tablestore instance resides.
Instance ID
Select the name of the destination Tablestore instance.
AccessKey ID of Alibaba Cloud Account
Enter the AccessKey ID of the Alibaba Cloud account that owns the Tablestore instance. The AccessKey ID is used to identify the user.
ImportantIf you enter the AccessKey ID of a Resource Access Management (RAM) user, you must grant the AliyunOTSFullAccess permission to the RAM user. This permission allows the user to manage Tablestore. For more information, see Grant permissions to a RAM user using a RAM policy.
AccessKey Secret of Alibaba Cloud Account
Enter the AccessKey secret of the Alibaba Cloud account that owns the Tablestore instance. The AccessKey secret is used to verify the user's identity.
After completing the configuration, click Test Connection and Proceed at the bottom of the page.
If the source or destination database is an Alibaba Cloud database instance, such as an RDS for MySQL instance or an ApsaraDB for MongoDB instance, DTS automatically adds the IP address of the DTS service for the corresponding region to the whitelist of the Alibaba Cloud database instance. If the source or destination database is a self-managed database on an ECS instance, DTS automatically adds the IP address of the DTS service for the corresponding region to the security rules of the ECS instance. You must also ensure that the self-managed database does not restrict access from the ECS instance. If the database is deployed in a cluster on multiple ECS instances, you must manually add the IP address of the DTS service for the corresponding region to the security rules of each of the other ECS instances. If the source or destination database is a self-managed database in an IDC or a database from another cloud provider, you must manually add the IP address of the DTS service for the corresponding region to allow access from the DTS servers. For more information about the IP addresses of the DTS service, see IP address blocks of DTS servers.
WarningAdding the public IP address blocks of the DTS service, either automatically or manually, may pose security risks. Using this product, you acknowledge that you understand and accept the potential security risks and that you must implement basic security measures. These measures include, but are not limited to, strengthening password security, limiting the ports open to each CIDR block, using authentication for internal API calls, and regularly checking and restricting unnecessary CIDR blocks. Alternatively, you can connect through a private network using a leased line, VPN Gateway, or Smart Access Gateway.
Configure the task objects.
On the Configure Objects page, you can configure the objects to synchronize.
Configuration
Description
Synchronization Types
DTS always selects Incremental Data Synchronization. By default, you must also select Schema Synchronization and Full Data Synchronization. After the precheck, DTS initializes the destination cluster with the full data of the selected source objects, which serves as the baseline for subsequent incremental synchronization.
Processing Mode of Conflicting Tables
Precheck and Report Errors: Checks for tables with the same names in the destination database. If any tables with the same names are found, an error is reported during the precheck and the data synchronization task does not start. Otherwise, the precheck is successful.
NoteIf you cannot delete or rename the table with the same name in the destination database, you can map it to a different name in the destination. For more information, see Object name mapping.
Ignore Errors and Proceed: Skips the check for tables with the same name in the destination database.
WarningSelecting Ignore Errors and Proceed may cause data inconsistency and put your business at risk. For example:
If the table schemas are consistent and a record in the destination database has the same primary key or unique key value as a record in the source database:
During full data synchronization, DTS retains the destination record and skips the source record.
During incremental synchronization, DTS overwrites the destination record with the source record.
If the table schemas are inconsistent, data initialization may fail. This can result in only partial data synchronization or a complete synchronization failure. Use with caution.
Operation Types
Select the operation types to synchronize based on your business needs. By default, all operation types are selected.
Processing Policy of Dirty Data
Select a policy to handle errors that occur when writing data. Valid values:
Skip
Block
Data Write Mode
Select a data write mode. Valid values:
Overwrite Row: Uses UpdateRowChange to overwrite data at the row level.
Update Row: Uses PutRowChange to update data at the row level.
Batch Write Mode
The API operation that is called for batch writes. Valid values:
BulkImportRequest: Offline write.
BatchWriteRowRequest: Batch write.
NoteWe recommend that you select BulkImportRequest for higher read and write efficiency and lower billing for the Tablestore instance.
More
If required, click More to configure the following parameters:
Queue Size: The queue length of the data write process for the Tablestore instance.
Thread Quantity: The number of callback handler threads for the data write process of the Tablestore instance.
Concurrency: The concurrent request limit for the Tablestore instance.
Buckets: The number of concurrent buckets for sequential writes of incremental data. A larger value can improve concurrent write performance.
NoteThe value of Buckets must be less than or equal to the value of Concurrency.
Capitalization of Object Names in Destination Instance
Configure the case-sensitivity policy for database, table, and column names in the destination instance. By default, the DTS default policy is selected. You can also choose to use the default policy of the source or destination database. For more information, see Case policy for destination object names.
Source Objects
In the Source Objects box, click the objects, and then click
to move them to the Selected Objects box.NoteYou can select objects to synchronize at the database or table level. If you select tables, other objects such as views, triggers, and stored procedures are not synchronized to the destination database.
You can synchronize tables from only one database. This means you can select only one database, or multiple tables from the same database.
Selected Objects
To rename a single object in the destination instance, right-click the object in the Selected Objects box. For more information, see Map a single object name.
To rename multiple objects in bulk, click Batch Edit in the upper-right corner of the Selected Objects box. For more information, see Map multiple object names in bulk.
NoteDatabase name mapping is not supported. You can map table and column names only when you select objects to synchronize at the table level. If you use the mapping feature, other objects that depend on the mapped object may fail to be synchronized.
When you use the column name mapping feature, you can change the type of the corresponding column in the destination Tablestore instance.
To set a WHERE clause to filter data, right-click the table to be synchronized in the Selected Objects box and set the filter condition in the dialog box that appears. For more information about how to set the condition, see Set a filter condition.
Click Next: Advanced Settings to configure advanced settings.
Configuration
Description
Dedicated Cluster for Task Scheduling
By default, DTS uses a shared cluster for tasks, so you do not need to make a selection. For greater task stability, you can purchase a dedicated cluster to run the DTS synchronization task. For more information, see What is a DTS dedicated cluster?.
Retry Time for Failed Connections
If the connection to the source or destination database fails after the synchronization task starts, DTS reports an error and immediately begins to retry the connection. The default retry duration is 720 minutes. You can customize the retry time to a value from 10 to 1,440 minutes. We recommend a duration of 30 minutes or more. If the connection is restored within this period, the task resumes automatically. Otherwise, the task fails.
NoteIf multiple DTS instances (e.g., Instance A and B) share a source or destination, DTS uses the shortest configured retry duration (e.g., 30 minutes for A, 60 for B, so 30 minutes is used) for all instances.
DTS charges for task runtime during connection retries. Set a custom duration based on your business needs, or release the DTS instance promptly after you release the source/destination instances.
Retry Time for Other Issues
If a non-connection issue (e.g., a DDL or DML execution error) occurs, DTS reports an error and immediately retries the operation. The default retry duration is 10 minutes. You can also customize the retry time to a value from 1 to 1,440 minutes. We recommend a duration of 10 minutes or more. If the related operations succeed within the set retry time, the synchronization task automatically resumes. Otherwise, the task fails.
ImportantThe value of Retry Time for Other Issues must be less than that of Retry Time for Failed Connections.
Enable Throttling for Full Data Synchronization
During full data synchronization, DTS consumes read and write resources from the source and destination databases, which can increase their load. To mitigate pressure on the destination database, you can limit the migration rate by setting Queries per second (QPS) to the source database, RPS of Full Data Migration, and Data migration speed for full migration (MB/s).
NoteThis parameter is available only if Synchronization Types is set to Full Data Synchronization.
You can also adjust the rate of full data synchronization when the synchronization instance is running.
Enable Throttling for Incremental Data Synchronization
You can also limit the incremental synchronization rate to reduce pressure on the destination database by setting RPS of Incremental Data Synchronization and Data synchronization speed for incremental synchronization (MB/s).
Environment Tag
If required, you can select an environment tag to identify the instance. In this example, no tag is selected.
Configure ETL
The extract, transform, and load (ETL) feature is not supported. Select No.
Whether to delete SQL operations on heartbeat tables of forward and reverse tasks
Choose whether DTS writes heartbeat SQL information to the source database while the instance is running.
Yes: Does not write heartbeat SQL information to the source database. The DTS instance may display latency.
No: Writes heartbeat SQL information to the source database. This may interfere with source database operations like physical backups and cloning.
Monitoring and Alerting
Choose whether to set up alerts. If the synchronization fails or the latency exceeds the specified threshold, DTS sends a notification to the alert contacts.
No: No alerts are configured.
Yes: Configures alerts. You must also set the alert threshold and alert notifications. For more information, see Configure monitoring and alerting during task configuration.
Click Next: Configure Database and Table Fields, and then click OK in the Note dialog box.
By default, DTS sets the primary key of the source table as the Primary Key Column. You can set Definition Status to All to modify the primary key.
NoteYou can select multiple columns for the Primary Key Column to form a composite primary key.
Click Next: Save Task and Precheck at the bottom of the page.
To view the parameters for configuring this instance by calling an API operation, move the mouse pointer over the Next: Save Task Settings and Precheck button and click Preview OpenAPI parameters in the bubble that appears.
If you do not need to view the API parameters or have finished viewing them, click Next: Save Task Settings and Precheck at the bottom of the page.
NoteA precheck is performed before the synchronization job starts. The job can start only after the precheck is passed.
If the precheck fails, click View Details next to the failed check item. Fix the issue based on the cause and run the precheck again.
If a warning is reported during the precheck:
For check items that cannot be ignored, click View Details next to the failed check item. Fix the issue based on the cause and run the precheck again.
For check items that can be ignored, click Click to Confirm Alert Details, Confirm Ignore, OK, and Rerun Precheck to skip the warning and run the precheck again. If you choose to ignore a warning, it may cause issues such as data inconsistency and pose a risk to your business.
When the Precheck Pass Rate reaches 100%, click Next: Purchase.
Purchase the instance.
On the Purchase page, select the billing method and link specifications for the data synchronization instance. For more information, see the following table.
Category
Parameter
Description
New Instance Class
Billing Method
Subscription: You pay upfront for a specific duration. This is cost-effective for long-term, continuous tasks.
Pay-as-you-go: You are billed hourly for actual usage. This is ideal for short-term or test tasks, as you can release the instance at any time to save costs.
Resource Group Settings
The resource group to which the instance belongs. The default is default resource group. For more information, see What is resource management?.
Instance Class
DTS offers synchronization specifications at different performance levels that affect the synchronization rate. Select a specification based on your business requirements. For more information, see Data synchronization link specifications.
Subscription Duration
In subscription mode, select the duration and quantity of the instance. Monthly options range from 1 to 9 months. Yearly options include 1, 2, 3, or 5 years.
NoteThis option appears only when the billing method is Subscription.
Read and select the checkbox for Data Transmission Service (Pay-as-you-go) Service Terms.
Click Buy and Start, and then click OK in the OK dialog box.
You can monitor the task progress on the data synchronization page.
Verify the result.
Log on to the Tablestore console.
In the top navigation bar, select a resource group and a region.
On the Overview page, click the instance name or click Instance Management in the Actions column of the instance.
On the Instance Details tab, click Data Table List to query the synchronized table data.