Data Transmission Service (DTS) supports migrating data from PolarDB-X 2.0 to Tablestore.
Prerequisites
A Tablestore instance has been created. For more information, see Create an instance.
Obtain the AccessKey ID and AccessKey secret of the Alibaba Cloud account that owns the Tablestore instance. For more information, see Create an AccessKey for an Alibaba Cloud account (not recommended).
Notes
Type | Description |
Source database limits |
|
Other limits |
|
SQL operations that support incremental migration
Operation type | SQL statement |
DML | INSERT, UPDATE, DELETE |
Permissions required for database accounts
Database | Schema migration | Full migration | Incremental migration |
Source PolarDB-X 2.0 | SELECT permission | SELECT Permission | REPLICATION SLAVE, REPLICATION CLIENT, and SELECT on the objects to be migrated. |
To create a database account and grant permissions:
For a PolarDB-X 2.0 instance, see Manage database accounts and Permissions required for an account to synchronize data.
Procedure
Go to the Data Migration Tasks page.
Log on to the Data Management (DMS) console.
In the top menu bar, click Integration & Development.
In the navigation pane on the left, choose .
To the right of Migration Tasks, select the region of the migration instance.
NoteThe actual operations may vary based on the mode and layout of the DMS console. For more information, see Simple mode and Customize the layout and style of the DMS UI.
You can also log on to the new DTS Data Migration Tasks page.
Click Create Task to open the task configuration page.
Optional: In the upper-right corner of the page, click New Configuration Page.
NoteIf the button in the upper-right corner of the new configuration page is Back to Previous Version, skip this step.
The parameters on the new and old configuration pages are different. 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 have 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.)
Select 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, you must enter the following database information.
Database Type
Select PolarDB-X 2.0.
Access Method
You can 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 migrate data between instances in the same Alibaba Cloud account. Select No. For more information about cross-account scenarios, see Configure a task for cross-account data migration.
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. For information about the permission requirements, see Permissions required for database accounts.
Database Password
Enter the password that corresponds to the 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.)
Select 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, you must enter the following database information.
Database Type
Select Tablestore.
Access Method
Select Alibaba Cloud Instance.
Instance Region
Select the region where the destination Tablestore instance is located.
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 RAM user, you must grant the AliyunOTSFullAccess permission to the RAM user. This permission allows the RAM 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 identity of the user.
After you complete the configuration, click Test Connectivity and Proceed at the bottom of the page.
If the source or destination database is an Alibaba Cloud database instance, such as an ApsaraDB RDS for MySQL or ApsaraDB for MongoDB instance, DTS automatically adds the CIDR blocks of DTS servers to the IP address whitelist of the instance. If the source or destination database is a self-managed database hosted on an Elastic Compute Service (ECS) instance, DTS automatically adds the CIDR blocks of DTS servers to the security group rules of the ECS instance. You must also ensure that the ECS instance can access the database. If the self-managed database is hosted on multiple ECS instances, you must manually add the CIDR blocks of DTS servers to the security group rules of each ECS instance. If the source or destination database is a self-managed database that is deployed in an on-premises data center or provided by a third-party cloud service provider, you must manually add the CIDR blocks of DTS servers to the IP address whitelist of the database to allow access from DTS. For more information about the IP addresses of DTS servers, see CIDR blocks of DTS servers.
WarningAutomatically or manually adding the public IP address blocks of DTS servers may pose security risks. Using this product, you acknowledge and accept the potential security risks. You must implement basic security measures. These measures include, but are not limited to, using strong passwords, limiting open ports for each CIDR block, using authentication for internal API calls, and regularly checking and restricting unnecessary CIDR blocks. You can also connect using an internal network, such as a leased line, VPN Gateway, or Smart Access Gateway.
Configure the task objects.
On the Configure Objects page, you can configure the objects to migrate.
Configuration
Description
Migration Types
If you only need to perform a full migration, select both Schema Migration and Full Data Migration.
To perform a migration with no downtime, select Schema Migration, Full Data Migration, and Incremental Data Migration.
NoteIf you do not select Schema Migration, ensure that a database and tables to receive the data exist in the destination database. Also, use the object name mapping feature in the Selected Objects box as needed.
If you do not select Incremental Data Migration, do not write new data to the source instance during data migration to ensure data consistency.
Processing Mode of Conflicting Tables
Precheck and Report Errors: Checks whether tables with the same names exist in the destination database. If no tables with the same names exist, the precheck item is passed. If tables with the same names exist, an error is reported during the precheck phase, and the data migration task does not start.
NoteIf a table in the destination database has the same name but cannot be easily deleted or renamed, you can change the name of the table in the destination database. For more information, see Object name mapping.
Ignore Errors and Proceed: Skips the check for tables with the same names.
WarningSelecting Ignore Errors and Proceed may cause data inconsistency and business risks. For example:
If the table schemas are consistent and a record in the destination database has the same primary key value as a record in the source database:
During full migration, DTS keeps the record in the destination cluster. The record from the source database is not migrated to the destination database.
During incremental migration, DTS does not keep the record in the destination cluster. The record from the source database overwrites the record in the destination database.
If the table schemas are inconsistent, only some columns of data may be migrated, or the migration may fail. Proceed with caution.
Operation Types
Select the operation types to migrate based on your business needs. By default, all operation types are selected.
Processing Policy of Dirty Data
Select the policy to handle data write errors. Valid values:
Skip
Block
Data Write Mode
Select the data write mode. Valid values:
Overwrite Row: Overwrites data at the row level using UpdateRowChange.
Update Row: Updates data in a row using PutRowChange.
Batch Write Mode
The API operation to call for batch writes. Valid values:
BulkImportRequest: Performs an offline write.
BatchWriteRowRequest: Performs a batch write operation.
NoteWe recommend that you select BulkImportRequest to improve read and write efficiency and reduce billing costs for your Tablestore instance.
More
If needed, click More to configure the following parameters:
Queue Size: The length of the queue for the process that writes data to the Tablestore instance.
Thread Quantity: The number of callback handler threads for writing data to the Tablestore instance.
Concurrency: The maximum number of concurrent requests for the Tablestore instance.
Buckets: Specifies the number of concurrent buckets used to write incremental data sequentially. Increasing this value can improve concurrent write performance.
NoteThe value for Buckets cannot exceed the value for Concurrency.
Capitalization of Object Names in Destination Instance
You can configure the case sensitivity policy for the English names of migrated objects, such as databases, tables, and columns, in the destination instance. By default, DTS default policy is selected. You can also choose to keep it consistent with the default policy of the source or destination database. For more information, see Case sensitivity of object names in the destination database.
Source Objects
In the Source Objects box, click the objects to migrate, and then click
to move them to the Selected Objects box.NoteYou can select objects to migrate at the database or table level. If you select tables as the migration objects, other objects such as views, triggers, and stored procedures are not migrated to the destination database.
You can migrate tables from only one database. This means you can select one database or multiple tables from the same database.
Selected Objects
To rename an object that you want to migrate to the destination instance, right-click the object in the Selected Objects section. For more information, see Individual table column mapping.
To rename multiple objects at a time, click Batch Edit in the upper-right corner of the Selected Objects section. For more information, see Map multiple object names at a time.
NoteDatabase name mapping is not supported. You can map table and column names only when you select tables as the migration objects. If you use the mapping feature, the migration of other objects that depend on the mapped object may fail.
When you use the column name mapping feature, you can modify the type of the corresponding column in the destination Tablestore instance.
To filter data with a WHERE clause, right-click the table in the Selected Objects box and set the filter condition in the dialog box that appears. For more information, see Set a filter condition.
Click Next: Advanced Settings.
Configuration
Description
Dedicated Cluster for Task Scheduling
By default, DTS schedules tasks on a shared cluster. You do not need to select one. If you want more stable tasks, you can purchase a dedicated cluster to run DTS migration tasks.
Retry Time for Failed Connections
After the migration task starts, if the connection to the source or destination database fails, DTS reports an error and immediately starts continuous retry attempts. The default retry duration is 720 minutes. You can also customize the retry time within a range of 10 to 1440 minutes. We recommend that you set it to more than 30 minutes. If DTS reconnects to the source and destination databases within the set time, the migration task automatically resumes. Otherwise, the task fails.
NoteFor multiple DTS instances that share the same source or destination, the network retry time is determined by the setting of the last created task.
Because you are charged for the task during the connection retry period, we recommend that you customize the retry time based on your business needs, or release the DTS instance as soon as possible after the source and destination database instances are released.
Retry Time for Other Issues
After the migration task starts, if other non-connectivity issues occur in the source or destination database (such as a DDL or DML execution exception), DTS reports an error and immediately starts continuous retry attempts. The default retry duration is 10 minutes. You can also customize the retry time within a range of 1 to 1440 minutes. We recommend that you set it to more than 10 minutes. If the related operations succeed within the set retry time, the migration task automatically resumes. Otherwise, the task fails.
ImportantThe value of Retry Time for Other Issues must be less than the value of Retry Time for Failed Connections.
Enable Throttling for Full Data Migration
During the full migration phase, DTS consumes some read and write resources of the source and destination databases, which may increase the database load. As needed, you can choose whether to set speed limits for the full migration task. You can set Queries per second (QPS) to the source database, RPS of Full Data Migration, and Data migration speed for full migration (MB/s) to reduce the pressure on the destination database.
NoteThis configuration item is available only if you select Full Data Migration for Migration Types.
You can also adjust the full migration speed after the migration instance is running.
Enable Throttling for Incremental Data Migration
As needed, you can also choose whether to set speed limits for the incremental migration task. You can set RPS of Incremental Data Migration and Data migration speed for incremental migration (MB/s) to reduce the pressure on the destination database.
NoteThis configuration item is available only if you select Incremental Data Migration for Migration Types.
You can also adjust the incremental migration speed after the migration instance is running.
Environment Tag
As needed, you can select an environment tag to identify the instance. In this example, no tag is selected.
Configure ETL
Select No because the extract, transform, and load (ETL) feature is not supported.
Whether to delete SQL operations on heartbeat tables of forward and reverse tasks
Choose whether to write heartbeat SQL information to the source database when the DTS instance is running.
Yes: Heartbeat SQL information is not written to the source database. This may cause the DTS instance to report a delay.
No: Writes heartbeat SQL information to the source database. This may interfere with features such as physical backup and cloning of the source database.
Monitoring and Alerting
Select whether to set alerts and receive alert notifications based on your business needs.
No: Does not set an alert.
Yes: Sets an alert. You must also set the alert threshold and alert contacts. The system sends an alert notification if the migration fails or the latency exceeds the threshold.
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. To modify this, set Definition Status to All.
NoteYou can create a composite primary key by selecting multiple columns for the Primary Key Column.
At the bottom of the page, click Next: Save Task and Pre-check.
To view the API operation parameters for configuring this instance, move the pointer over Next: Save Task Settings and Precheck and click Preview OpenAPI parameters in the pop-up 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.
NoteBefore the migration task starts, DTS performs a precheck. The migration task can start only after all precheck items are passed.
If the precheck fails, click View Details next to the failed item. Resolve the issue and run the precheck again.
If a warning is reported for a check item:
For failed checks that cannot be ignored, click View Details next to the check. Resolve the issue and run the precheck again.
To ignore a warning for a check item, click Confirm Warning Details, Confirm Ignore, and OK. Then, click Rerun Precheck to run the precheck again. If you choose to ignore a warning, data inconsistency may occur and pose risks to your business.
If the Precheck success rate is 100%, click Next: Purchase.
Purchase the instance.
On the Purchase page, select the link specification for the data migration instance. For more information, see the following table.
Category
Parameter
Description
New Instance Class
Resource Group Settings
Select the resource group to which the instance belongs. The default value is default resource group. For more information, see What is Resource Management?
Instance Class
DTS provides migration specifications with different performance levels. The link specification affects the migration speed. You can select a specification based on your business scenario. For more information, see Data migration link specifications.
After the configuration is complete, read and select Data Transmission Service (Pay-as-you-go) Service Terms.
Click Buy and Start, and in the OK dialog box that appears, click OK.
You can view the progress of the migration instance on the Data Migration Tasks list page.
NoteIf the migration instance does not include an incremental migration task, it stops automatically. After the instance stops, its Status is Completed.
If the migration instance includes an incremental migration task, it does not stop automatically, and the incremental migration task continues to run. While the incremental migration task is running normally, the Status of the instance is Running.
Verify the result.
Log on to the Tablestore console.
At the top of the page, select a resource group and a region.
On the Overview page, click the instance name, or click Instance Management in the Actions column for the instance.
On the Instance Details tab, click Data Table List to query the migrated table data.