This topic describes how to migrate data from an ApsaraDB RDS for MySQL instance to a DataHub project by using Data Transmission Service (DTS).
|Limits on the source database||
If the source database is a self-managed MySQL database, take note of the following limits:
|Migration type||Task configuration fee||Internet traffic fee|
|Schema migration||Free of charge.||Charged only when data is migrated from Alibaba Cloud over the Internet. For more information, see Pricing.|
SQL operations that can be migrated
|Operation type||SQL statement|
|DML||INSERT, UPDATE, and DELETE|
Permissions required for database accounts
|Source ApsaraDB RDS for MySQL instance||The read permissions on the objects to migrate|
- Click Create Task. On the page that appears, configure the source and destination databases.Warning After you select the source and destination instances, we recommend that you read the limits displayed at the top of the page. This helps you create and run the data synchronization task.
Section Parameter Description None Task Name
DTS automatically generates a task name. We recommend that you specify an informative name to identify the task. You do not need to use a unique task name.
Source Database Database Type Select MySQL. Access Method Select Alibaba Cloud Instance. Instance Region Select the region in which the source ApsaraDB RDS for MySQL instance resides. Replicate Data Across Alibaba Cloud Accounts In this example, select No because data is replicated within the same Alibaba Cloud account. RDS Instance ID Select the ID of the source ApsaraDB RDS for MySQL instance. Database Account Enter the database account of the source ApsaraDB RDS for MySQL instance. For information about the permissions that are required for the account, see Permissions required for database accounts. Database Password
Enter the password of the database account.
Select Non-encrypted or SSL-encrypted. If you want to select SSL-encrypted, you must enable SSL encryption for the ApsaraDB RDS for MySQL instance before you configure the data synchronization task. For more information, see Configure SSL encryption on an ApsaraDB RDS for MySQL instance.
Destination Database Database Type Select DataHub. Access Method Select Alibaba Cloud Instance. Instance Region Select the region in which the DataHub instance resides. Project Select the destination DataHub instance for Project.
- Select objects for the task and configure advanced settings.
- Basic Settings
Parameter Description Task Stages You can select only Schema Migration and Incremental Data Migration. Full Data Migration cannot be selected.Note If Incremental Data Migration is not selected, we recommend that you do not write data to the source instance during data migration. This ensures data consistency between the source and destination instances. Processing Mode of Conflicting Tables
Precheck and Report Errors: checks whether the destination database contains tables that have the same names as tables in the source database. If the source and destination databases do not contain identical table names, the precheck is passed. Otherwise, an error is returned during the precheck and the data migration task cannot be started.Note You can use the object name mapping feature to rename the tables that are migrated to the destination database. You can use this feature if the source and destination databases contain identical table names and the tables in the destination database cannot be deleted or renamed. For more information, see Map object names.
- Ignore Errors and Proceed: skips the precheck for identical table names in the source and destination databases.
Warning If you select Ignore Errors and Proceed, data consistency is not guaranteed and your business may be exposed to potential risks.
- If the source and destination databases have the same schema, and a data record has
the same primary key as an existing data record in the destination database:
- During incremental data migration, DTS migrates the data record to the destination database. The existing data record in the destination database is overwritten.
- If the source and destination databases have different schemas, initial data migration may fail. In this case, only some columns are migrated, or the data migration task fails.
- If the source and destination databases have the same schema, and a data record has the same primary key as an existing data record in the destination database:
Apply New Naming Rules of Additional ColumnsAfter DTS synchronizes data to DataHub, DTS adds additional columns to the destination topic. If the names of additional columns are the same as the names of existing columns in the destination topic, data synchronization fails. Select Yes or No to specify whether you want to enable the new naming rules for additional columns.Warning Before you specify this parameter, check whether additional columns and existing columns in the destination topic have name conflicts. For more information, see Modify the naming rules for additional columns.Note You can select only databases as the objects to migrate. Rename Databases and Tables
You can specify WHERE conditions to filter data. For more information, see Use SQL conditions to filter data.
In the Selected Objects section, right-click an object. In the dialog box that appears, select the DML operations that you want to migrate. For more information, see SQL operations that can be migrated.
- Advanced Settings
Parameter Description Capitalization of Object Names in Destination Instance
Specify the capitalization of database names, table names, and column names in the destination instance. By default, DTS default policy is selected. You can select other options to make sure that the capitalization of object names is consistent with that of the source or destination database. For more information, see Specify the capitalization of object names in the destination instance.
Retry Time for Failed ConnectionSpecify the 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 data synchronization task. Otherwise, the data synchronization task fails.Note
- If multiple DTS instances have the same source or destination database, the lowest value takes effect. For example, the retry time is set to 30 minutes for Instance A and 60 minutes for Instance B, DTS retries failed connections at an interval of 30 minutes.
- When DTS retries a connection, you are charged for the DTS instance. We recommend that you specify the retry time based on your business needs. You can also release the DTS instance at your earliest opportunity after the source and destination instances are released.
- Basic Settings
- Click Next: Save Task Settings and Precheck in the lower part of the page. Note
- Before you can start the data synchronization task, DTS performs a precheck. You can start the data synchronization task only after the task passes the precheck.
- If the task fails to pass the precheck, you can click the icon next to each failed item to view details.
- You can troubleshoot the issues based on the causes and run a precheck again.
- If you do not need to troubleshoot the issues, you can ignore failed items and run a precheck again.
- Wait until the Success Rate becomes 100%. Then, click Next: Purchase Instance.
- Read and select Data Transmission Service (Pay-as-you-go) Service Terms.