This topic describes how to use the data transmission service to migrate data from a PolarDB-X 1.0 database to a MySQL tenant of OceanBase Database.
A data migration task remaining in an inactive state for a long time may fail to be restored depending on the retention period of incremental logs. Inactive states are Failed, Stopped, and Completed. The data transmission service releases data migration tasks remaining in an inactive state for more than 3 days to reclaim related resources. We recommend that you configure alerts for data migration tasks and handle task exceptions in a timely manner.
Background
PolarDB-X 1.0 is a cloud-native distributed database developed in house by Alibaba Group. It is integrated with a distributed SQL engine and an exclusively developed distributed storage X-DB and is designed based on the cloud-native integrated architecture. PolarDB-X 1.0 supports over ten million concurrent requests and provides a large storage capacity for hundreds of petabytes of data. For more information, see Product overview.
After the task that migrates data from a PolarDB-X 1.0 database to a MySQL tenant of OceanBase Database is successfully started, the task will be automatically deleted. The data transmission service automatically creates tasks to migrate data from the MySQL databases mounted to the PolarDB-X 1.0 database to the MySQL tenant of OceanBase Database. The number of tasks depends on the number of underlying MySQL instances in the PolarDB-X 1.0 database.
We recommend that you filter the tasks by tag or task name for batch start, batch pause, batch start forward switchover, and more operations. For more information about batch operations, see Perform batch operations on data migration tasks.
Prerequisites
The data transmission service has the privilege to access cloud resources. For more information, see Grant privileges to roles for data transmission.
You have created dedicated database users for data migration in the source PolarDB-X 1.0 database and the target MySQL tenant of OceanBase Database and granted the corresponding privileges to the users.
Limitations
Limitations on the source database
Do not perform DDL operations that modify database or table schemas during full migration. Otherwise, the data migration task may be interrupted.
The data transmission service supports PolarDB-X 1.0 databases of versions 5.2.8, 5.4.2, 5.4.9, and 5.4.12.
The data transmission service supports MySQL databases of versions 5.5, 5.6, 5.7, and 8.0 that are compatible with the ApsaraDB RDS for MySQL instances mounted to PolarDB-X 1.0 databases, as well as standard ApsaraDB RDS for MySQL and PolarDB for MySQL instances.
The data transmission service supports the migration of an object only when the following conditions are met: the database name, table name, and column name of the object are ASCII-encoded without special characters. The special characters are line breaks, spaces, and the following characters: . | " ' ` ( ) = ; / & \.
When you migrate data from a PolarDB-X 1.0 database to a MySQL tenant of OceanBase Database, the data transmission service does not support the following cases:
Schema migration or reverse incremental synchronization
Migration across Alibaba Cloud accounts
View migration
Inconsistent usernames or passwords of the ApsaraDB RDS for MySQL instances mounted to the source PolarDB-X 1.0 database
OceanBase Database supports the UTF8MB4, GBK, GB18030, binary, and UTF-16 character sets.
Considerations
For the migration of tables without unique keys (tables with primary keys or NOT NULL unique keys), when you restart or restore full migration, the data transmission service automatically truncates the target tables that have been synchronized before the restart or resumption. However, for a data migration task that migrates tables without unique keys from an ApsaraDB RDS for MySQL database mounted to the PolarDB-X 1.0 database to a MySQL tenant of OceanBase Database, the data transmission service does not automatically truncate the target tables when you restart or restore full migration.
If you do not specify mappings for objects of the PolarDB-X 1.0 database, all data of physical tables is synchronized to physical tables with the same names at the target.
A difference between the source and target table schemas may result in data consistency. Some known scenarios are described as follows:
When you manually create a table schema at the target, if the data type of any column is not supported by the data transmission service, implicit data type conversion may occur at the target, which causes inconsistent column types between the source and target databases.
If the length of a column at the target is shorter than that in the source database, the data of this column may be automatically truncated, which causes data inconsistency between the source and target databases.
If you selected only Incremental Synchronization when you created the data migration task, the data transmission service requires that the local incremental logs of the source database be retained for at least 48 hours.
If you have selected Full Migration and Incremental Synchronization when you created the data migration task, the data transmission service requires that the local incremental logs of the source database be retained for at least 7 days. If the data transmission service cannot obtain incremental logs, the data migration task may fail or even the data between the source and target databases may be inconsistent after migration.
If the source or target database contains table objects that differ only in letter cases, the data migration results may not be as expected due to case insensitivity in the source or target database.
Supported source and target instance types
In the following table, OB_MySQL stands for the MySQL tenant of OceanBase Database.
Source | Target |
PolarDB-X 1.0 (Alibaba Cloud PolarDB-X 1.0 instance) | OB_MySQL (OceanBase cluster instance) |
PolarDB-X 1.0 (Alibaba Cloud PolarDB-X 1.0 instance) | OB_MySQL (serverless instance) |
Procedure
Log on to the ApsaraDB for OceanBase console and purchase a data migration task.
For more information, see Purchase a data migration task.
Choose Data Transmission > Data Migration. On the page that appears, click Configuration for the data migration task.
If you want to reference the configurations of an existing task, click Reference Configuration. For more information, see Reference the configuration of a data migration task.
On the Select Source and Target page, configure the parameters.
Parameter
Description
Migration Task Name
We recommend that you set it to a combination of digits and letters. It must not contain any spaces and cannot exceed 64 characters in length.
Source
If you have created a PolarDB-X 1.0 data source, select it from the drop-down list. Otherwise, click New Data Source in the drop-down list and create one in the dialog box that appears on the right. For more information about the parameters, see Create a PolarDB-X 1.0 data source.
Target
If you have created a data source for the MySQL tenant of OceanBase Database, select it from the drop-down list. Otherwise, click New Data Source in the drop-down list and create one in the dialog box that appears on the right. For more information about the parameters, see Create an OceanBase data source.
Tag
Select a target tag from the drop-down list. You can also click Manage Tags to create, modify, and delete tags. For more information, see Use tags to manage data migration tasks.
NoteAfter the task that migrates data from a PolarDB-X 1.0 database to a MySQL tenant of OceanBase Database is successfully started, the task will be automatically deleted. You need to add a proper tag to the task.
Click Next. On the Select Migration Type page, specify migration types for the current data migration task.
Supported migration types are full migration, incremental synchronization, and full verification.
Migration type
Description
Full migration
After a full migration task is started, the data transmission service migrates existing data from tables in the source database to corresponding tables in the target database.
Before data migration, assess the performance of the source and target databases. We recommend that you perform data migration during off-peak hours. During full migration, the data transmission service consumes some read and write resources in the source and target databases. This may increase the loads of the databases. For more information, see Performance assessment of migration assessment.
Incremental synchronization
After an incremental synchronization task is started, the data transmission service synchronizes changed data (data that is added, modified, or removed) from the source database to corresponding tables in the target database.
Incremental synchronization supports the following DML operations:
Insert
,Delete
, andUpdate
. You can select statements based on your business needs. For more information, see Configure DDL/DML synchronization.Full verification
After the full migration and incremental synchronization tasks are completed, the data transmission service automatically initiates a full verification task to verify the tables in the source and target databases.
If you have selected Incremental Synchronization but did not select all DML statements in the DML Synchronization section, the data transmission service does not support full verification.
Before data migration, assess the performance of the source and target databases. We recommend that you perform data migration in off-peak hours. During full verification, the data transmission service consumes some read resources in the source and target databases. This may increase the loads of the databases.
Click Next. On the Select Migration Objects page, specify migration objects for the data migration task.
At present, you can select migration objects only by using the Specify Objects option. Select the objects to be migrated on the left, and click > to add them to the list on the right. You can select tables of one or more databases as the migration objects.
The data transmission service allows you to import objects from text files, rename target objects, set row filters, view column information, and remove a single or all migration objects.
Operation
Description
Import objects
In the list on the right, click Import Objects in the upper-right corner.
In the dialog box that appears, click OK.
ImportantThis operation will overwrite previous selections. Proceed with caution.
In the Import Objects dialog box, import the objects to be migrated.
You can import CSV files to rename databases or tables and set row filtering conditions. For more information, see Download and import the settings of migration objects.
Click Validate.
After you import the migration objects, check their validity. Column field mapping is not supported at present.
After the validation succeeds, click OK.
Rename objects
The data transmission service allows you to rename migration objects. For more information, see Rename a database table.
Configure settings
The data transmission service allows you to filter rows by using
WHERE
conditions. For more information, see Use SQL conditions to filter data.You can also view column information of the migration objects in the View Columns section.
Remove one or all objects
The data transmission service allows you to remove a single object or all migration objects that are added to the right-side list during data mapping.
Remove a single migration object
In the list on the right, move the pointer over the object that you want to remove, and click Remove to remove the migration object.
Remove all migration objects
In the list on the right, click Remove All in the upper-right corner. In the dialog box that appears, click OK to remove all migration objects.
Click Next. On the Migration Options page, configure the parameters.
Full migration
The following table describes the parameters for full migration, which are displayed only if you have selected Full Migration on the Select Migration Type page.
Parameter
Description
Read Concurrency
The concurrency for reading data from the source during full migration. The maximum value is 512. A high read concurrency may incur excessive stress on the source, affecting the business.
Write Concurrency
The concurrency for writing data to the target during full migration. The maximum value is 512. A high write concurrency may incur excessive stress on the target, affecting the business.
Full Migration Rate Limit
You can choose whether to limit the full migration rate as needed. If you choose to limit the full migration rate, you must specify the records per second (RPS) and bytes per second (BPS). The RPS specifies the maximum number of data rows migrated to the target per second during full migration, and the BPS specifies the maximum amount of data in bytes migrated to the target per second during full migration.
NoteThe RPS and BPS values specified here are only for throttling. The actual full migration performance is subject to factors such as the settings of the source and target and the instance specifications.
Handle Non-empty Tables in Target Database
Valid values: Ignore and Stop Migration.
If you select Ignore, when the data to be inserted conflicts with existing data of a target table, the data transmission service logs the conflicting data while retaining the existing data.
ImportantIf you select Ignore, data is pulled in IN mode during full verification. In this case, verification is inapplicable if the target contains data that does not exist in the source, and the verification performance is downgraded.
If you select Stop Migration and a target table contains records, an error prompting migration unsupported is reported during full migration. In this case, you must process the data in the target table before continuing with the migration.
ImportantIf you click Restore in the dialog box prompting the error, the data transmission service ignores this error and continues to migrate data. Proceed with caution.
Incremental synchronization
The following table describes the parameters for incremental synchronization, which are displayed only if you have selected Incremental Synchronization on the Select Migration Type page.
Parameter
Description
Write Concurrency
The concurrency for writing data to the target during incremental synchronization. The maximum value is 512. A high write concurrency may incur excessive stress on the target, affecting the business.
Incremental Synchronization Rate Limit
You can choose whether to limit the incremental synchronization rate as needed. If you choose to limit the incremental synchronization rate, you must specify the RPS and BPS. The RPS specifies the maximum number of data rows synchronized to the target per second during incremental synchronization, and the BPS specifies the maximum amount of data in bytes synchronized to the target per second during incremental synchronization.
NoteThe RPS and BPS values specified here are only for throttling. The actual incremental synchronization performance is subject to factors such as the settings of the source and target and the instance specifications.
Incremental Synchronization Start Timestamp
This parameter is not displayed if you have selected Full Migration on the Select Migration Type page.
If you have selected Incremental Synchronization but not Full Migration, specify a point in time after which the data is to be synchronized. The default value is the current system time. For more information, see Set an incremental synchronization timestamp.
Click Precheck to start a precheck on the data migration task.
During the precheck, the data transmission service checks the read and write privileges of the database users and the network connections of the databases. A data migration task can be started only after it passes all check items. If an error is returned during the precheck, you can perform the following operations:
Identify and troubleshoot the problem and then perform the precheck again.
Click Skip in the Actions column of the failed precheck item. In the dialog box that prompts the consequences of the operation, click OK.
After the precheck succeeds, click Start Task.
If you do not need to start the task now, click Save. You can start the task later on the Migration Tasks page or by performing batch operations. For more information about batch operations, see Perform batch operations on data migration tasks.
A task for data migration from the PolarDB-X 1.0 database to the MySQL tenant of OceanBase Database is automatically deleted after it is started. The data transmission service retains the tasks for data migration from the databases mounted to the PolarDB-X 1.0 database to the MySQL tenant of OceanBase Database and automatically creates the corresponding data sources. In the dialog box that appears, you can click Download as file to save the related information as a CSV file.
Click OK in the dialog box. On the Migration Tasks page, you can start one or more tasks for data migration from a MySQL database to the MySQL tenant of OceanBase Database.
The data transmission service allows you to modify the migration objects when a migration task is running. For more information, see View and modify migration objects and their filter conditions. After the data migration task is started, it will be executed based on the selected migration types. For more information, see View migration details.