A DuckDB-based analytical primary instance provides columnar storage, just-in-time (JIT) compilation, vectorized execution, efficient memory management, and parallel processing. It delivers up to 100 times the complex query performance of the InnoDB engine. You can use Data Transmission Service (DTS) to synchronize the database schema and data from an RDS for MySQL instance to a DuckDB-based analytical primary instance. This enables you to quickly build enterprise business intelligence (BI), interactive query, and real-time reporting systems.
Applicability
-
You have a target RDS DuckDB analytical primary instance. For more information, see Create a DuckDB-based analytical primary instance.
-
Ensure the target RDS DuckDB analytical primary instance has more storage space than the source database uses.
Precautions
-
Tables in the RDS for MySQL instance must have a primary key to be synchronized.
-
When DTS performs initial full data synchronization, it consumes read and write resources on the source and destination databases and can increase their load. We recommend performing data synchronization during off-peak hours, for example, when the CPU load of both databases is below 30%.
-
Do not perform an online DDL change on synchronization objects in the source database by using tools such as gh-ost or pt-online-schema-change. Otherwise, the synchronization will fail.
-
The cluster of a DuckDB-based analytical primary instance is locked if a node's disk space usage exceeds 80%. Estimate the space required for the objects to be synchronized in advance and ensure that the destination cluster has sufficient storage space.
-
The use of prefix indexes is not supported and may cause data synchronization to fail.
-
If you back up the destination DuckDB-based analytical primary instance while a DTS task is running, the task will fail.
-
You cannot use a DuckDB-based analytical primary instance as a data source for data synchronization.
-
If a
DMLstatement containsLIMIT, a non-deterministic function such asUUID(), or anXAtransaction, it is anunsafeoperation for replication. This may cause data inconsistency. Avoid using these statements when you synchronize data to a DuckDB-based analytical primary instance.
Billing
|
Synchronization type |
Pricing |
|
Schema synchronization and full data synchronization |
Free of charge. |
|
Incremental data synchronization |
Charged. For more information, see Billing overview. |
Source instance types
Data synchronization tasks support the following source MySQL instance types:
-
RDS for MySQL
-
A self-managed database on an ECS instance
-
An on-premises self-managed database
This topic describes the configuration procedure using RDS for MySQL as an example. The steps for a self-managed MySQL source database are similar.
A self-managed MySQL source database requires additional preparations. For more information, see overview of preparations.
Supported SQL operations
-
DDL operations:
CREATE TABLE,DROP TABLE,RENAME TABLE,TRUNCATE TABLE,ADD COLUMN,DROP COLUMN, andMODIFY COLUMN -
DML operations:
INSERT,UPDATE, andDELETE
-
ORDER BYandLIMITare not supported inUPDATEorDELETEstatements. -
Changing a source table's field type during data synchronization will cause the synchronization job to fail. You can fix this error manually. For more information, see Fix synchronization failures caused by changing field types.
Database account permissions
|
Database |
Permissions |
|
RDS MySQL |
A privileged account is recommended. If you use a standard account, it must have the |
|
DuckDB analytical primary instance |
A privileged account is recommended. If you use a standard account, it must have the |
Steps
-
Log in to the Data Transmission Service console. From the left navigation pane, choose Data Synchronization. In the top navigation bar, select the target region.
-
On the Data Synchronization page, click Create Task.
-
On the page, configure the source and destination databases.
Source instance
Parameter
Description
database type
connection method
cloud instance
instance region
The region of the source instance. This was selected when you purchased the data synchronization instance and cannot be changed.
cross-account
Single account
instance ID
Select the source RDS instance ID.
database account
Enter the database account for the source RDS instance. For details on required permissions, see Database account permissions.
database password
Enter the password for the database account.
connection method
Select Non-encrypted or SSL-encrypted based on your requirements. If you select SSL-encrypted, you must enable SSL encryption for the RDS instance in advance. For more information, see Use a cloud certificate to quickly enable SSL encryption.
ImportantCurrently, the Encryption can be set only in the Chinese mainland and China (Hong Kong) regions.
Destination instance
Parameter
Description
database type
connection method
cloud instance
instance region
The region of the destination instance. This was selected when you purchased the data synchronization instance and cannot be changed.
cross-account
Single account
NoteDTS supports cross-region data synchronization. The example in this topic focuses on data synchronization between instances in the same region and VPC to show how to ensure data consistency. For more information about data synchronization, see Overview of data synchronization scenarios.
RDS instance ID
Select the ID of the destination DuckDB instance.
database account
Enter the database account for the RDS for DuckDB primary analytical instance. For details on required permissions, see Database account permissions.
database password
Enter the password for the database account.
connection method
Select Non-encrypted or SSL-encrypted as needed. If you select SSL-encrypted, you need to enable SSL encryption for the RDS instance in advance. For more information, see Quickly enable SSL link encryption with a cloud certificate.
ImportantCurrently, the Encryption can be set only in the Chinese mainland and China (Hong Kong) regions.
-
Click Test Connectivity and Proceed to continue.
-
In the CIDR Blocks of DTS Servers dialog box, click Test connection.
-
Configure the task objects.
-
On the Configure Objects page, configure the objects to synchronize.
Parameter
Description
Synchronization Types
-
For full synchronization only, select both Schema Synchronization and Full Data Synchronization.
-
For synchronization without downtime, select Schema Synchronization, Full Data Synchronization, and Incremental Data Synchronization.
Note-
If you do not select Schema Synchronization, make sure that the destination database contains the required databases and tables. You can then use the table and column name mapping feature in the Selected Objects box.
-
If you do not select Incremental Data Synchronization, do not write new data to the source instance during synchronization to ensure data consistency.
Method to Migrate Triggers in Source Database
Select a method to migrate triggers. If the objects to migrate do not have triggers, you can skip this parameter. For more information, see Configure a method to synchronize or migrate triggers.
NoteYou can configure this parameter only when you select Schema Synchronization for Synchronization Types.
Enable Migration Assessment
This feature evaluates whether the schemas of the source and destination databases, such as index length, stored procedures, and dependent tables, meet the requirements. Select Yes or No.
Note-
You can configure this parameter only when you select Schema Synchronization for Synchronization Types.
-
If you select Yes, the precheck may take longer. You can view the Assessment Result during the precheck phase. The evaluation result does not affect the precheck result.
Synchronization Topology
Select One-way Synchronization.
Processing Mode of Conflicting Tables
-
Precheck and Report Errors: Checks whether a table with the same name exists in the destination database. If no table with the same name exists, this check item passes. If a table with the same name exists, an error is reported during the precheck, and the data synchronization task does not start.
NoteIf you cannot delete or rename the table with the same name in the destination database, you can change the name of the table in the destination database. For more information, see Map table and column names.
-
Ignore Errors and Proceed: Skips the check for tables with the same name in the destination database.
WarningIf you select Ignore Errors and Proceed, data inconsistency may occur, which may pose risks to your business. 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 synchronization, DTS retains the record in the destination cluster. The record from the source database is not migrated.
-
During incremental synchronization, DTS does not retain 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 data from some columns may be synchronized, or the task may fail. Proceed with caution.
-
Whether to migrate Event
Select whether to migrate events from the source database based on your business requirements. If you select Yes, you must also follow the relevant requirements and perform subsequent operations. For more information, see Synchronize or migrate events.
Capitalization of Object Names in Destination Instance
You can configure the case sensitivity policy for the names of synchronized objects, including databases, tables, and columns, in the destination instance. By default, DTS default policy is selected. You can also choose to align the policy with the default policy of the source or destination database. For more information, see Case Sensitivity for Destination Object Names.
Source Objects
In the Source Objects box, select the objects to be synchronized and click
to move them to the Selected Objects box.NoteYou can select objects to synchronize at the database, table, or column level. If you select only tables or columns, other object types such as views, triggers, and stored procedures are not synchronized to the destination database.
Selected Objects
-
To change the name of an individual object in the destination instance, right-click the object in the Selected Objects box. For instructions on setting the name, see Map table and column names.
-
To batch edit the names of multiple objects in the destination instance, click Batch Edit in the upper-right corner of the Selected Objects box. For instructions on setting the names, see Map table and column names.
Note-
To select the SQL operations to synchronize for a specific database or table, right-click the object in the Selected Objects box and select the desired SQL operations in the dialog box that appears.
-
To filter data by using 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 to configure advanced parameters.
This example uses the default settings. You can customize them as needed.
-
Click Next: Data Validation to configure a data validation task.
To use the data validation feature, select one or more data validation methods as needed. You can retain the default values for other parameters or customize them based on your business requirements. For instructions on how to configure the parameters, see Configure data validation.
NoteIf you select schema validation, the validation process may report a "data inconsistency" error due to historical compatibility issues, even if the schema has already been synchronized. This is a non-critical alert and does not affect the actual synchronization result. To avoid false positives, we recommend that you do not enable schema validation during data validation.
-
Click Next: Save Task Settings and Precheck to precheck the synchronization task.
-
-
When the Success Rate reaches 100%, click Next: Purchase Instance.
Note-
A synchronization job must pass a precheck before it can start.
-
If the precheck fails, click the
icon next to the failed check item for details.-
Fix the issue as prompted, then rerun the precheck.
-
Alternatively, select Ignore or Ignore Alert Items and Rerun Precheck.
-
-
-
On the buy page, select a billing method and link specification for the data synchronization instance. The following table describes each parameter.
Category
Parameter
Description
New Instance Class
Billing method
-
Subscription: You pay when you create the instance. This billing method is ideal for long-term use and is more cost-effective than Pay-As-You-Go.
-
Pay-As-You-Go: You are billed by the hour. This billing method is ideal for short-term use. To save costs, you can release the instance when it is no longer needed.
Resource group
The resource group that contains the instance. The default value is default resource group. For more information, see What is Resource Management?.
Link specification
The link specification affects the synchronization speed. Select a specification with a performance level that meets your business needs. For more information, see Specifications of data synchronization links.
Subscription duration
If you select the Subscription billing method, specify the instance quantity and subscription duration. You can subscribe for 1 to 9 months, or for 1, 2, 3, or 5 years.
NoteThis parameter is only available for the Subscription billing method.
-
-
Once the configuration is complete, select the Data Transmission Service (Pay-as-you-go) Service Terms, click Buy and Start, and in the OK dialog box, click Yes.
-
After completing the purchase, you will be returned to the Data Synchronization list page. Click the ID of the task you just created to open its details page. In the left navigation pane, click Task Management to view the progress. The screen below indicates that the historical data migration is complete and incremental data is being synchronized in real time.
Fix synchronization failures from field type changes
If you change the field type of a source table during data synchronization, the synchronization job reports an error and stops. To resolve this issue, follow these steps.
-
In the destination instance, create a new table B (for example, customer_new) based on the schema of table A (for example, customer), which failed to synchronize. Adjust the field types of table B as needed.
-
Run the INSERT INTO SELECT command to copy the data from table A to the new table B. Then, verify that the data in both tables is consistent.
-
Rename or delete the original table A, and then rename table B to customer.
-
In the DTS console, restart the data synchronization job.