Synchronizing data from MySQL
Synchronize data from a MySQL database using Alibaba Cloud Data Transmission Service (DTS) by following these seven steps.
Step 1: Prerequisites
Complete these prerequisites before you configure a synchronization task.
-
(Optional) Connect to Alibaba Cloud: Ensure that your business environment can connect to Alibaba Cloud. You can skip this step if your source environment or Alibaba Cloud instance has public access.
-
Access authorization:
-
Network and security settings: Ensure that the DTS server can access the source and destination databases. For the complete list of IP addresses for the destination region, see Add the IP addresses of DTS servers to an IP address whitelist.
-
Source and destination databases: For configuration requirements and limitations for the source and destination databases, see Data synchronization from a MySQL source: Limitations.
Step 2: Create a sync task
-
Log in to the Data Transmission Service (DTS) console.
-
In the left-side navigation pane, click Data Synchronization. In the upper-left corner, select the region of the synchronization instance.
-
Click Create Task to open the task configuration page.
-
Task Name: DTS automatically generates a task name. Specify a descriptive name for easy identification. The name does not have to be unique.
-
Configure the source and target databases:
Source Database
Configuration parameters depend on the Access Method. Select the method that suits your scenario.
Alibaba Cloud Instance
Parameter
Description
Select Existing Connection
-
If you need to use a database instance that has been added to the system (created or saved), select the desired database instance from the drop-down list. The database information below is then automatically configured.
NoteIn the DMS console, this parameter is labeled Select a DMS database instance..
-
If the instance is not registered, or if you prefer not to use a registered one, manually configure the following parameters.
Database Type
Select MySQL.
Access Method
Select Alibaba Cloud Instance.
Instance Region
Select the region where the source RDS MySQL instance is located.
Replicate Data Across Alibaba Cloud Accounts
-
Specify whether the source database is in a different Alibaba Cloud account. If you select Yes, you must configure the Alibaba Cloud Account and RAM Role Name parameters.
Alibaba Cloud Account
Enter the numeric ID of the other Alibaba Cloud Account ID.
RAM Role Name
Enter the name of the RAM role.
RDS Instance ID
Select the source RDS instance ID.
Database Account
Enter the account for the source RDS MySQL instance.
Database Password
Enter the password for the database account.
Encryption
Select Non-encrypted or SSL-encrypted.
Express Connect, VPN Gateway, or Smart Access Gateway
Parameter
Description
Select Existing Connection
-
If you need to use a database instance that has been added to the system (created or saved), select the desired database instance from the drop-down list, and the database information below will be automatically configured.
NoteIn the DMS console, this parameter is labeled Select a DMS database instance..
-
If the instance is not registered, or if you prefer not to use a registered one, manually configure the following parameters.
Database Type
Select MySQL.
Access Method
Select Express Connect, VPN Gateway, or Smart Access Gateway.
Instance Region
Select the region of the VPC connected to the source database.
Replicate Data Across Alibaba Cloud Accounts
-
Specify whether the source database is in a different Alibaba Cloud account. If you select Yes, you must configure the Alibaba Cloud Account and RAM Role Name parameters.
Alibaba Cloud Account
Enter the numeric ID of the other Alibaba Cloud Account ID.
RAM Role Name
Enter the name of the RAM role.
Connected VPC
Select the VPC connected to the source database.
Domain Name or IP
Enter the source database endpoint.
Port Number
Enter the source database port.
Database Account
Enter the account for the source database.
Database Password
Enter the password for the database account.
Encryption
Select Non-encrypted or SSL-encrypted. If the source database uses an SSL-encrypted, you must also upload the CA Certificate and enter the CA Certificate Password.
Primary/Secondary vSwitch in VPC Tunnel
Select the primary vSwitch (Primary) and secondary vSwitch (Secondary) for the VPC data channel.
Public IP Address
Parameter
Description
Select Existing Connection
-
If you want to use a database instance that has been added to the system (created or saved), select the desired database instance from the drop-down list. The database information below will be automatically configured.
NoteIn the DMS console, this parameter is labeled Select a DMS database instance..
-
If the instance is not registered, or if you prefer not to use a registered one, manually configure the following parameters.
Database Type
Select MySQL.
Access Method
Select Public IP Address.
Instance Region
Select the region closest to your source database.
Domain Name or IP
Enter the source database endpoint.
Port Number
Enter the source database port.
Database Account
Enter the account for the source database.
Database Password
Enter the password for the database account.
Encryption
Select Non-encrypted or SSL-encrypted. If the source database uses an SSL-encrypted, you must also upload the CA Certificate and enter the CA Certificate Password.
Self-managed Database on ECS
Parameter
Description
Select Existing Connection
-
If you need to use a database instance that has been added to the system (created or saved), select the desired database instance from the drop-down list. The database information below will be automatically configured.
NoteIn the DMS console, this parameter is labeled Select a DMS database instance..
-
If the instance is not registered, or if you prefer not to use a registered one, manually configure the following parameters.
Database Type
Select MySQL.
Access Method
Select Self-managed Database on ECS.
Instance Region
Select the region where the ECS instance is located.
Replicate Data Across Alibaba Cloud Accounts
-
Specify whether the source database is in a different Alibaba Cloud account. If you select Yes, you must configure the Alibaba Cloud Account and RAM Role Name parameters.
Alibaba Cloud Account
Enter the numeric ID of the other Alibaba Cloud Account ID.
RAM Role Name
Enter the name of the RAM role.
ECS Instance ID
Select the ECS instance ID.
Port Number
Enter the database port on the ECS instance.
Database Account
Enter the account for the source database.
Database Password
Enter the password for the database account.
Encryption
Select Non-encrypted or SSL-encrypted. If the source database uses an SSL-encrypted, you must also upload the CA Certificate and enter the CA Certificate Password.
Cloud Enterprise Network (CEN)
Parameter
Description
Select Existing Connection
-
If you need to use a database instance that has been added to the system (newly created or saved), select the required database instance from the drop-down list. The database information below will be automatically configured.
NoteIn the DMS console, this parameter is labeled Select a DMS database instance..
-
If the instance is not registered, or if you prefer not to use a registered one, manually configure the following parameters.
Database Type
Select MySQL.
Access Method
Select Cloud Enterprise Network (CEN).
Instance Region
Select the region where the source database is located.
Replicate Data Across Alibaba Cloud Accounts
-
Specify whether the source database is in a different Alibaba Cloud account. If you select Yes, you must configure the Alibaba Cloud Account and RAM Role Name parameters.
Alibaba Cloud Account
Enter the numeric ID of the other Alibaba Cloud Account ID.
RAM Role Name
Enter the name of the RAM role.
CEN Instance ID
Select the CEN instance ID.
Connected VPC
From the selected CEN instance, select the VPC connected to the source database.
Domain Name or IP
Enter the source database endpoint.
Port Number
Enter the source database port.
Database Account
Enter the account for the source database.
Database Password
Enter the password for the database account.
Encryption
Select Non-encrypted or SSL-encrypted. If the source database uses an SSL-encrypted, you must also upload the CA Certificate and enter the CA Certificate Password.
Database Gateway
Parameter
Description
Select Existing Connection
-
If you need to use a database instance that has been registered in the system (created or saved), select the desired database instance from the drop-down list. The database information below will be automatically configured.
NoteIn the DMS console, this parameter is labeled Select a DMS database instance..
-
If the instance is not registered, or if you prefer not to use a registered one, manually configure the following parameters.
Database Type
Select MySQL.
Access Method
Select Database Gateway.
Instance Region
Select the region where the DG is located.
Database Gateway ID
Select the ID of your Database Gateway.
Database Endpoint
Select the database address managed by the Database Gateway.
Database Account
Enter the account for the source database.
Database Password
Enter the password for the database account.
Encryption
Select Non-encrypted or SSL-encrypted. If the source database uses an SSL-encrypted, you must also upload the CA Certificate and enter the CA Certificate Password.
Destination Database
The Access Method options for the Access Method depend on the connection method of the source database. See the console for available options. The following sections list the required parameters for each Access Method.
NoteConnecting to a target database using a Public IP Address address is not supported. Use a data migration task for this purpose instead.
Alibaba Cloud Instance
Parameter
Description
Example image
Select Existing Connection
-
To use a database instance that has been registered with the system (newly created or saved), select it from the drop-down list. Its information is automatically populated.
NoteIf you are on the Data Management (DMS) console, this parameter is named Select a DMS database instance..
-
If the database instance is not registered or you do not want to use a registered one, manually configure the information below.
To configure the target database information, set Database type to relational database > MySQL and Connection method to Cloud instance. For Region, select the region where the target instance is located, such as China (Beijing). For Cross-account, select No. Then, select the RDS instance ID, enter the database account and database password. For Connection mode, select unencrypted connection or SSL-encrypted connection.
Database Type
Select the required database type. This example uses MySQL.
Access Method
Select Alibaba Cloud Instance.
Instance Region
Select the region where the target database is located.
Replicate Data Across Alibaba Cloud Accounts
-
Indicates whether to connect across different Alibaba Cloud accounts. If you select Yes, you must configure the Alibaba Cloud Account and RAM Role Name parameters.
Alibaba Cloud Account
Enter the Alibaba Cloud Account ID.
RAM Role Name
Enter the name of the Resource Access Management (RAM) role.
RDS Instance ID
Select the instance ID of the target RDS for MySQL instance. If you select a different Database Type, select the corresponding instance ID.
Database Account
Enter the account for the target RDS for MySQL instance.
Database Password
Enter the password that corresponds to the database account.
Encryption
Select either Non-encrypted or SSL-encrypted.
Express Connect, VPN Gateway, or Smart Access Gateway
Parameter
Description
Example image
Select Existing Connection
-
To use a database instance that has been registered with the system (newly created or saved), select it from the drop-down list. Its information is automatically populated.
NoteIf you are on the Data Management (DMS) console, this parameter is named Select a DMS database instance..
-
If the database instance is not registered or you do not want to use a registered one, manually configure the information below.
In the target database information form, set Database type to MySQL and Connection method to Express Connect, VPN Gateway, or Smart Access Gateway. Then, configure Region, VPC connected to the target database, Domain name or IP address, Port (default is 3306), database account, and database password. For Connection mode, select unencrypted connection or SSL-encrypted connection. In the VPC data channel section, configure the Primary vSwitch and Standby vSwitch.
Database Type
Select the required database type. This example uses MySQL.
Access Method
Select Express Connect, VPN Gateway, or Smart Access Gateway.
Instance Region
Select the region of the VPC that is connected to the target database.
Connected VPC
Select the VPC that is connected to the target database.
Domain Name or IP
Enter the connection endpoint of the target database.
Port Number
Enter the port of the target database.
Database Account
Enter the account for the target database.
Database Password
Enter the password that corresponds to the database account.
Encryption
Select an Non-encrypted or an SSL-encrypted based on your requirements. If an SSL-encrypted is enabled for the destination database, you also need to upload a CA Certificate and enter the CA Certificate Password.
Primary/Secondary vSwitch in VPC Tunnel
Select the vSwitch (Primary) and vSwitch (Secondary) that Data Transmission Service (DTS) will use to access the data source through the VPC data channel.
Self-managed Database on ECS
Parameter
Description
Example image
Select Existing Connection
-
To use a database instance that has been registered with the system (newly created or saved), select it from the drop-down list. Its information is automatically populated.
NoteIf you are on the Data Management (DMS) console, this parameter is named Select a DMS database instance..
-
If the database instance is not registered or you do not want to use a registered one, manually configure the information below.
In the Target database information section, set Database type to relational database > MySQL and Connection method to Self-managed database on an ECS instance. Then, configure Region, ECS instance ID, Port (default is
3306), database account, database password, and Connection mode (unencrypted connection or SSL-encrypted connection).Database Type
Select the required database type. This example uses MySQL.
Access Method
Select Self-managed Database on ECS.
Instance Region
Select the region where the Elastic Compute Service (ECS) instance is located.
ECS Instance ID
Select the ECS instance ID.
Port Number
Enter the port of the self-managed MySQL database on the ECS instance.
Database Account
Enter the account for the self-managed MySQL database.
Database Password
Enter the password that corresponds to the database account.
Encryption
Select Non-encrypted or SSL-encrypted based on your requirements. If the destination database has SSL-encrypted enabled, you also need to upload the CA Certificate and enter the CA Certificate Password.
Cloud Enterprise Network (CEN)
Parameter
Description
Example image
Select Existing Connection
-
To use a database instance that has been registered with the system (newly created or saved), select it from the drop-down list. Its information is automatically populated.
NoteIf you are on the Data Management (DMS) console, this parameter is named Select a DMS database instance..
-
If the database instance is not registered or you do not want to use a registered one, manually configure the information below.
In the target database information section, set Database type to relational database > MySQL and Connection method to Cloud Enterprise Network (CEN). Then, configure Region, CEN instance ID, VPC connected to the database, Domain name or IP address, Port (default is 3306), database account, and database password. For connection mode, select unencrypted connection.
Database Type
Select the required database type. This example uses MySQL.
Access Method
Select Cloud Enterprise Network (CEN).
Instance Region
Select the region where the target database is located.
CEN Instance ID
Select the CEN instance ID.
Connected VPC
Select the VPC in the CEN instance that is connected to the target database.
Domain Name or IP
Enter the connection endpoint of the target database.
Port Number
Enter the port of the target database.
Database Account
Enter the account for the target database.
Database Password
Enter the password that corresponds to the database account.
Encryption
Select Non-encrypted or SSL-encrypted based on your actual situation. If the destination database uses an SSL-encrypted, you also need to upload a CA Certificate and enter the CA Certificate Password.
Database Gateway
Parameter
Description
Example image
Select Existing Connection
-
To use a database instance that has been registered with the system (newly created or saved), select it from the drop-down list. Its information is automatically populated.
NoteIf you are on the Data Management (DMS) console, this parameter is named Select a DMS database instance..
-
If the database instance is not registered or you do not want to use a registered one, manually configure the information below.
If you select Database Gateway (DG) as the connection method, configure Region, Database Gateway ID, Database address, database account, database password, and Connection mode (optional: unencrypted connection or SSL-encrypted connection). If you connect using a public domain name, performance depends on public network conditions. For standard hybrid cloud solutions with an IDC, we recommend using Express Connect.
Database Type
Select the required database type. This example uses MySQL.
Access Method
Select Database Gateway.
Instance Region
Select the region where the Database Gateway (DG) is located.
Database Gateway ID
Select the Database Gateway ID.
Database Endpoint
Select the database address managed by the DG.
Database Account
Enter the account for the target database instance.
Database Password
Enter the password that corresponds to the database account.
Encryption
Select Non-encrypted or SSL-encrypted as required. If an SSL-encrypted is enabled for the destination database, you also need to upload a CA Certificate and enter the CA Certificate Password.
-
-
-
After completing the configuration, click Test Connectivity and Proceed to verify that DTS can connect to the source and destination databases. If the CIDR Blocks of DTS Servers dialog box appears, add the IP addresses it displays to the security settings of the corresponding source or destination database. Then, click Confirm authorization and test link. If the connection test is successful, you will be automatically redirected to configure the task objects.
Step 3: Configure synchronization objects and advanced options
-
On the Configure Objects page, configure settings such as the synchronization type and synchronization objects. The available settings vary by target database type. Select the tab for your target database type to view the corresponding settings.
MySQL
Parameter
Description
Synchronization Types
Incremental Data Synchronization is selected by default. You also need to select Schema Synchronization and Full Data Synchronization. After the precheck, Data Transmission Service (DTS) initializes the target cluster with the full data of the synchronization objects from the source instance. This data serves as the baseline for subsequent incremental synchronization.
Method to Migrate Triggers in Source Database
Select a method to synchronize triggers based on your requirements. If the objects to be synchronized do not involve triggers, you can skip this setting. For more information, see Configure how to synchronize or migrate triggers.
NoteThis parameter is available only when you select Synchronization Types for Schema Synchronization.
Enable Migration Assessment
This feature assesses if the source and target database schemas meet requirements, checking elements like index length, stored procedures, and dependent tables. You can select Yes or No based on your needs.
Note-
This parameter is available only when you select Synchronization Types for Schema Synchronization.
-
If you select Yes, the precheck may take longer. You can view the Assessment Result during the precheck phase. The assessment result does not affect the precheck result.
Synchronization Topology
Select One-way Synchronization or Two-way Synchronization based on your business requirements. Two-way Synchronization is supported only for specific source and target instance pairs. For more information, see Data synchronization topologies.
Enable Exactly-Once Write
If the synchronization objects include tables without a primary key or unique constraint, select Yes. For more information, see Synchronize tables without primary keys and unique constraints.
NoteThis parameter is available only when you select Synchronization Topology for Two-way Synchronization.
Exclude DDL Operations
-
Yes: Does not synchronize DDL operations.
-
No: Synchronizes DDL operations.
Note-
This parameter is available only when you select Synchronization Topology for Two-way Synchronization.
-
To ensure stability in bidirectional synchronization, this setting applies only to the forward task (source to target). DDL operations are always filtered for the reverse task (target to source).
Global Conflict Resolution Policy
If conflicts occur, select a suitable conflict resolution policy based on your business requirements.
-
Overwrite (If a conflict occurs, the conflicting record in the destination instance is overwritten): Overwrites the record in the target instance with the conflicting record from the source.
-
TaskFailed (If a conflict occurs, an error is reported and the task is stopped): Reports an error and stops the task. You must then resolve the conflict manually.
-
Ignore (If a conflict occurs, the conflicting record in the destination instance is used): Skips the conflicting operation and retains the existing record in the target instance.
Note-
This parameter is available only when you select Synchronization Topology for Two-way Synchronization.
-
If the synchronization task is paused or restarted and latency occurs, these policies do not take effect during the latency period. The data in the target instance is overwritten by default.
Processing Mode of Conflicting Tables
-
Precheck and Report Errors: Checks whether a table with the same name exists in the target database. If none exist, the precheck passes. If a table with the same name exists, the precheck fails, and the task does not start.
NoteIf you cannot delete or rename the table with the same name in the target database, you can change the table name in the target database. For more information, see schema, table, and column name mapping.
-
Ignore Errors and Proceed: Skips the check for tables with the same name in the target database.
WarningIf you select Ignore Errors and Proceed, data inconsistency may occur and pose risks to your business. For example:
-
If the table schemas are consistent and a record in the target database has the same primary key or unique key value as a record in the source database:
-
During full synchronization, DTS retains the record in the target cluster. The record from the source database is not synchronized to the target database.
-
During incremental synchronization, DTS does not retain the record in the target cluster. The record from the source database overwrites the record in the target database.
-
-
If the table schemas are inconsistent, the task may fail or only partially synchronize data. Use this option with caution.
-
Whether to migrate Event
Select whether to synchronize events from the source database. If you select Yes, you must meet specific requirements and perform additional steps. For more information, see Synchronize or migrate events.
Capitalization of Object Names in Destination Instance
You can configure the case sensitivity policy for the schema, table, and column names of synchronization objects in the target instance. By default, DTS default policy is selected. You can also select Consistent with the source database or Consistent with the default policy of the destination database. For more information, see Case sensitivity of target object names.
Source Objects
In the Source Objects box, click the objects that you want to synchronize, and then click
to move them to the Selected Objects box.NoteYou can select synchronization objects at the database, table, or column level. If you select tables or columns as synchronization objects, other types of objects such as views, triggers, and stored procedures are not synchronized to the target database.
Selected Objects
-
To rename an object in the target instance, right-click the synchronization object in the Selected Objects box. For configuration instructions, see Map a single schema, table, or column name.
-
To rename multiple objects in the target instance at once, click Selected Objects in the upper-right corner of the Batch Edit box. For configuration instructions, see Map schema, table, and column names in batches.
Note-
Using the object name mapping feature may cause synchronization to fail for objects that depend on the renamed object.
-
To select the SQL operations to be synchronized at the database or table level, right-click a synchronization 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 to be synchronized in the Selected Objects box and set the filter condition in the dialog box that appears. For instructions on how to set a filter condition, see Configure filter conditions.
Kafka
Parameter
Description
Synchronization Types
Incremental Data Synchronization is selected by default. You also need to select Schema Synchronization and Full Data Synchronization. After the precheck, Data Transmission Service (DTS) initializes the target cluster with the full data of the synchronization objects from the source instance. This data serves as the baseline for subsequent incremental synchronization.
NoteIf the Access Method of the target Kafka instance is Alibaba Cloud Instance, Schema Synchronization is not supported.
Processing Mode of Conflicting Tables
-
Precheck and Report Errors: Checks whether a table with the same name exists in the target database. If none exist, the precheck passes. If a table with the same name exists, the precheck fails, and the task does not start.
NoteIf you cannot delete or rename the table with the same name in the target database, you can change the table name in the target database. For more information, see schema, table, and column name mapping.
-
Ignore Errors and Proceed: Skips the check for tables with the same name in the target database.
WarningIf you select Ignore Errors and Proceed, data inconsistency may occur and pose risks to your business. For example:
-
If the table schemas are consistent and a record in the target database has the same primary key or unique key value as a record in the source database:
-
During full synchronization, DTS retains the record in the target cluster. The record from the source database is not synchronized to the target database.
-
During incremental synchronization, DTS does not retain the record in the target cluster. The record from the source database overwrites the record in the target database.
-
-
If the table schemas are inconsistent, the task may fail or only partially synchronize data. Use this option with caution.
-
Data Format in Kafka
Select the storage format for data that is synchronized to the Kafka instance.
-
If you select DTS Avro, you must parse the data based on the DTS Avro schema definition. For more information, see DTS Avro schema definition and DTS Avro deserialization examples.
-
If you select Canal JSON, see Canal JSON format for parameter descriptions and examples.
-
If you select Shareplex JSON, see Shareplex JSON for parameter descriptions and examples.
Synchronize all fields
Specifies whether to synchronize all fields.
Kafka Data Compression Format
Select a compression format for Kafka messages based on your requirements.
-
LZ4 (default): Low compression ratio but very fast.
-
GZip: High compression ratio, but slow and CPU-intensive.
-
Snappy: A balance between compression ratio and speed.
Policy for Shipping Data to Kafka Partitions
Select a policy based on your business requirements.
Message acknowledgement mechanism
Select a message acknowledgment mechanism based on your business requirements.
Topic That Stores DDL Information
From the drop-down list, select the topic that you want to use to store DDL information.
NoteIf you do not select a topic, DDL information is stored in the topic that receives data by default.
Capitalization of Object Names in Destination Instance
You can configure the case sensitivity policy for the schema, table, and column names of synchronization objects in the target instance. By default, DTS default policy is selected. You can also select Consistent with the source database or Consistent with the default policy of the destination database. For more information, see Case sensitivity of target object names.
Source Objects
In the Source Objects box, click the objects that you want to synchronize, and then click
to move them to the Selected Objects box.NoteYou can select synchronization objects at the database, table, or column level. If you select tables or columns as synchronization objects, other types of objects such as views, triggers, and stored procedures are not synchronized to the target database.
Selected Objects
In this example, no additional configuration is required. You can use the mapping feature to specify the topic name for the source table in the target Kafka instance, and select the DML and DDL operations, column names, or other information to be synchronized.
Note-
To select the SQL operations to be synchronized at the database or table level, right-click a synchronization object in the Selected Objects box and select the desired SQL operations in the dialog box that appears.
-
Using the object name mapping feature may cause synchronization to fail for objects that depend on the renamed object.
AnalyticDB for MySQL 3.0
Parameter
Description
Synchronization Types
Incremental Data Synchronization is selected by default. You also need to select Schema Synchronization and Full Data Synchronization. After the precheck, Data Transmission Service (DTS) initializes the target cluster with the full data of the synchronization objects from the source instance. This data serves as the baseline for subsequent incremental synchronization.
NoteIf you select Full Data Synchronization, tables to be synchronized for which
CREATE TABLEstatements are executed (including table schema and data) can be synchronized to the target database.DDL and DML Operations to Be Synchronized
Select the DML and DDL operations to be synchronized at the instance level. All operations are selected by default.
NoteTo select the SQL operations to be synchronized at the database or table level, right-click a synchronization object in the Selected Objects box and select the desired SQL operations in the dialog box that appears.
Merge Tables
Specifies whether to synchronize multiple source tables that have the same schema (sharded tables) to a single table in the target database.
-
Yes: In OLTP scenarios, database sharding and table splitting are often used to improve the response speed of business tables. In OLAP scenarios, such as for this target database, a single data table can store massive amounts of data and single-table queries are more convenient. In such scenarios, you can use the multi-table merging feature of DTS to synchronize multiple source tables that have the same schema (sharded tables) to a single table in the target database. For more information, see Enable multi-table merging.
Note-
After you select multiple source tables, you must use the object name mapping feature to map them to the same table name in the target database. For more information about the object name mapping feature, see schema, table, and column name mapping.
-
DTS adds the
__dts_data_sourcecolumn of the TEXT type to the synchronized target table to identify the source of each row. DTS writes values in the format ofDTS instance ID:database name:schema name:table nameto the column to distinguish the table source. Example:dts********:dtstestdata:testschema:customer1. -
Multi-table merging is a task-level feature and is not supported at the table level. If you want to enable multi-table merging for some tables but not for others, you must create two data synchronization tasks.
WarningDo not perform DDL operations that change the database or table schema on the source database. Otherwise, data inconsistency or task failures may occur.
-
-
No: This is the default option.
Processing Mode of Conflicting Tables
Precheck and Report Errors: Checks for tables with the same names in the destination database. If any tables with the same names are found, an error is reported during the precheck and the data synchronization task does not start. Otherwise, the precheck is successful.
NoteIf you cannot delete or rename the table with the same name in the destination database, you can map it to a different name in the destination. For more information, see Object name mapping.
Ignore Errors and Proceed: Skips the check for tables with the same name in the destination database.
WarningSelecting Ignore Errors and Proceed may cause data inconsistency and put your business at risk. For example:
If the table schemas are consistent and a record in the destination database has the same primary key or unique key value as a record in the source database:
During full data synchronization, DTS retains the destination record and skips the source record.
During incremental synchronization, DTS overwrites the destination record with the source record.
If the table schemas are inconsistent, data initialization may fail. This can result in only partial data synchronization or a complete synchronization failure. Use with caution.
Capitalization of Object Names in Destination Instance
You can configure the case sensitivity policy for the schema, table, and column names of synchronization objects in the target instance. By default, DTS default policy is selected. You can also select Consistent with the source database or Consistent with the default policy of the destination database. For more information, see Case sensitivity of target object names.
Source Objects
In the Source Objects box, click the objects that you want to synchronize, and then click
to move them to the Selected Objects box.Note-
You can select synchronization objects at the database, table, or column level. If you select tables or columns as synchronization objects, other types of objects such as views, triggers, and stored procedures are not synchronized to the target database.
-
If you select an entire database as the synchronization object, the following default behavior applies:
-
If a table to be synchronized in the source database has a primary key (single-column or multi-column), the primary key column(s) are used as the distribution key.
-
Selected Objects
-
To rename an object in the target instance, right-click the synchronization object in the Selected Objects box. For configuration instructions, see Map a single schema, table, or column name.
-
To rename multiple objects in the target instance at once, click Selected Objects in the upper-right corner of the Batch Edit box. For configuration instructions, see Map schema, table, and column names in batches.
Note-
To select the SQL operations to be synchronized at the database or table level, right-click a synchronization 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 to be synchronized in the Selected Objects box and set the filter condition in the dialog box that appears. For instructions on how to set a filter condition, see Configure filter conditions.
-
-
Click Advanced Settings. In most cases, you can use the default settings.
Step 4: (Optional) Configure data verification
If the destination database type supports data verification, click **Next** to configure the Data Verification task. If data verification is not supported, you are automatically redirected to Step 5: Pre-check and Purchase.
-
Select a Data Verification Mode:
Note-
Full Data Verification: Verifies the data synchronized by the full task. If the instance does not include an incremental task, verification starts after the instance is created and the full data write is complete. If the instance includes an incremental task, verification starts after the instance is created and when the incremental task first achieves zero latency.
-
Incremental Data Verification: Verifies the data from the incremental task. Verification starts after the instance is created and when the incremental task first achieves zero latency.
-
Schema Verification: Verifies the schema of the selected objects. If the instance does not include an incremental task, verification starts after the instance is created and after schema synchronization and the full data write are complete. If the instance includes an incremental task, verification starts after the instance is created and when the incremental task first achieves zero latency.
Full verification
If you select Full Data Verification, you also need to configure the parameters described in the following table.
Parameter
Description
Full Data Verification
-
Full field validation by row sampling: Specify a sampling percentage. DTS verifies all fields in the sampled data. The value must be an integer from 10 to 100.
-
Verify based on the number of table rows: Verifies only the row count for the full task. This mode does not verify row-level data.
NoteThe Verify based on the number of table rows mode is free of charge. The Full field validation by row sampling mode is billed based on the amount of data verified.
Timeout Settings for Full Data Verification
-
No: The full verification task is not forcibly terminated if it times out.
-
Yes: Specify a timeout period for the full verification task. The timer starts when the task begins. If the verification task does not complete within the specified period, DTS forcibly terminates it. The value must be an integer from 1 to 72.
Full calibration reference
-
Default: Uses the union of the source and destination databases as the baseline to verify data consistency.
-
Source Database: Uses the source database as the baseline to verify that the destination database is consistent with it. Data that exists only in the destination database is not verified.
-
Destination Database: Uses the destination database as the baseline to verify that the source database is consistent with it. Data that exists only in the source database is not verified.
Maximum number of rows of data read per second by full verification (RPS)
Full data verification consumes database read resources. You can limit the read rate of the full verification task to reduce the load on the database.
NoteA value of 0 indicates no limit. If both Maximum number of rows of data read per second by full verification (RPS) and Maximum amount of data read per second by full verification (MBps) are set to 0, no throttling is applied.
Maximum amount of data read per second by full verification (MBps)
Incremental verification
If you select Incremental Data Verification, you also need to configure the following parameters.
Parameter
Description
Incremental Verification Benchmark
Select the DML operations to verify. Supported operations include Source INSERT Operation, Source UPDATE Operation, and Source DELETE Operation.
-
-
Configure Verification Objects: All objects are selected by default. You can remove the objects on the right that do not need to be verified..
-
Configure verification alarms: Configure the parameters in the following table.
NoteYou can also set or modify data verification alarms after the DTS instance has started.
Parameter
Description
Full Data Verification Alert
-
No: No alarm is configured.
-
Yes: Configure alarms. You must also select and configure alarm rules. The following alarm rules are supported:
-
An alarm is triggered if the full verification task fails.
-
Set a threshold for data inconsistency. An alarm is triggered if the number of inconsistent records in the full verification task is greater than or equal to the specified threshold.
-
Incremental Data Verification Alert
-
No: No alarm is configured.
-
Yes: Configure alarms. You must also select and configure alarm rules. The following alarm rules are supported:
-
An alarm is triggered if the incremental verification task fails.
-
Set the number of evaluation cycles, the duration of each cycle, and the inconsistency threshold. An alarm is triggered if the number of inconsistent records is greater than or equal to the threshold for the specified number of consecutive cycles.
-
Set the number of evaluation cycles, the duration of each cycle, and the latency threshold. An alarm is triggered if the verification latency is greater than or equal to the threshold for the specified number of consecutive cycles.
-
NoteIf you configure verification alarms, you must also enter the mobile phone number of the Alert Contact. When a verification task triggers an alarm, an SMS notification is sent to this contact.
-
Step 5: Pre-check and purchase
-
Save the task and run a pre-check. DTS verifies that the configurations, permissions, and network settings of the source and target databases meet synchronization requirements. After the pre-check passes, click Next: Purchase Instance.
-
To view the OpenAPI parameters for configuring this instance, hover over the Next: Save Task Settings and Precheck button and click Preview OpenAPI parameters in the tooltip.
-
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.
Note-
A synchronization job can start only after it successfully passes a pre-check.
-
If the pre-check fails, click View Details next to the failed item, resolve the issue as instructed, and then run the pre-check again.
-
If the pre-check returns a warning:
-
For items that cannot be ignored, click View Details next to the item, resolve the issue as instructed, and then run the pre-check again.
-
For items that can be ignored, click Confirm Alert Details, Ignore, OK, and then Precheck Again to ignore the warning and rerun the pre-check. Note that ignoring warnings can cause data inconsistencies and other business risks.
-
After the pre-check is complete, the page displays all check items and their results. In this example, there are 19 check items and the pass rate is 100%. The Target SUPER Privilege Check returns a warning, while the other 18 items are successful. The successful items include checks for source and target database connectivity, permissions, binlog-related settings, storage engines, MySQL password format, and objects with the same name.
-
-
On the purchase page, configure the billing method and link specification.
-
Billing method: You can select Subscription, Pay-as-you-go, or Pay-as-you-go Serverless. For more information, see Billing Method.
-
Instance Class: Determines the maximum performance (RPS) for incremental synchronization. Select a specification, such as
smallormedium, based on the data change frequency in your source database. For more information, see Specifications. -
After completing the configuration, read and select the Data Transmission Service (Pay-as-you-go) Service Terms checkbox.
-
Click Buy and Start. In the displayed OK dialog box, click OK to complete the purchase. The task then starts automatically.
-
On the purchase page, configure the resource group and synchronization topology. This example uses one-way synchronization.
Step 6: (Optional) Configure reverse synchronization
-
Wait until the Status of the forward synchronization task is Running.
-
Navigate to the reverse synchronization task and click Configure Task.
-
Configure the reverse synchronization task by following the steps above.
Important-
For a reverse synchronization task, the roles of the instances are swapped: the source instance is the original target, and the target instance is the original source. Ensure that all connection details, such as the database name, account, and password, are correct for each instance.
-
The Instance Region of the source and target databases cannot be changed in a reverse synchronization task. This task has fewer parameters to configure than a forward synchronization task. Refer to the console for the specific parameters.
-
For a reverse synchronization task, the Processing Mode of Conflicting Tables setting ignores tables synchronized by the forward synchronization task.
-
A reverse synchronization task does not synchronize the objects specified in the Selected Objects list of the forward synchronization task.
-
To prevent potential data inconsistency, we recommend not using object mapping when you configure a reverse synchronization task.
-
-
When the Success Rate reaches 100%, click Back.
Step 7: Monitor and validate
After the task starts, it proceeds through the configured phases: Incremental Data Collection, Schema Migration, Full Data Synchronization, Incremental Write, and Full Data Verification.
-
View status: View the task's current phase and running status in the synchronization task list. When incremental synchronization begins and latency stabilizes within seconds, the full load is complete, and DTS is synchronizing incremental data in real time.
-
Data validation: Check for data consistency in the Check Details section of the Full Data Verification or Schema Verification tabs.