Migrate data from PolarDB-X 2.0 to Tablestore
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.
Notes
Type | Description |
Source database limits |
|
Other limits |
|
SQL operations supported for incremental migration
| Operation type | SQL statements |
|---|---|
| DML | INSERT, UPDATE, DELETE |
Required database account permissions
| Database | Schema migration | Full data migration | Incremental data migration |
|---|---|---|---|
| Source PolarDB-X 2.0 | SELECT | SELECT | REPLICATION SLAVE, REPLICATION CLIENT, and SELECT on objects to migrate |
For instructions on creating accounts and granting permissions, 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 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
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 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 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 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 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 database is accessible from the ECS instance. 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 servers. For more information about the IP addresses of DTS servers, see CIDR blocks of DTS servers.
WarningAdding the public IP address blocks of DTS servers, whether automatically or manually, may introduce security risks. Using this product, you acknowledge and accept these potential risks. You must implement basic security measures, such as 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.
Note-
If you do not select Schema Migration, you must ensure that a database and tables to receive the data exist in the destination database. You can 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 is passed. If tables with the same names exist, an error is reported during the precheck, 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 database. The record from the source database is not migrated.
-
During incremental migration, DTS does not keep the record in the destination database. 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 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 the case sensitivity 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 change the name of a single migration object in the target instance, right-click the object in the Selected Objects box. For more information, see Map individual schema, table, and column names.
-
To change the names of multiple migration objects in the target instance, click Selected Objects in the upper-right corner of the Batch Edit box. For more information, see Map multiple schema, table, and column names.
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 begins to retry the connection. The default retry duration is 720 minutes. You can customize the retry time to a value from 10 to 1440 minutes. We recommend that you set the duration to more than 30 minutes. If DTS reconnects to the source and destination databases within the specified duration, the migration task automatically resumes. Otherwise, the task fails.
Note-
For 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 a non-connectivity issue, such as a DDL or DML execution exception, occurs in the source or destination database, DTS reports an error and immediately begins to retry the operation. The default retry duration is 10 minutes. You can customize the retry time to a value from 1 to 1440 minutes. We recommend that you set the duration to more than 10 minutes. If the related operations succeed within the specified retry duration, 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 full migration, DTS consumes read and write resources on the source and destination databases, which may increase the database load. If required, you can enable throttling 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 load on the destination database.
Note-
This 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
If required, you can also choose 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 load on the destination database.
Note-
This 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 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
Select whether to set alerts and receive alert notifications based on your business needs.
-
No: Does not set an alert.
-
Yes: Configure alerts by setting an alert threshold and an alert contact. If a migration fails or the latency exceeds the threshold, the system sends an alert notification.
-
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. In the OK dialog box that appears, click OK.
You can view the progress of the migration task on the Data Migration Tasks list page.
Note-
If the migration task does not include incremental migration, it stops automatically after the full migration is complete. After the task stops, its Status changes to Completed.
-
If the migration task includes incremental migration, it does not stop automatically. The incremental migration task continues to run. While the incremental migration task is running, the Status of the task 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.