When you include events in a data synchronization or migration instance, a schema is updated due to the events that the synchronization or migration object depends on. In this case, the data are synchronized or migrated to the destination database earlier than thay are to source database, and the data in the source and destination databases may become inconsistent. This topic describes how to use Data Transmission Service (DTS) to synchronize or migrate events to avoid data inconsistency.
Prerequisites
The data synchronization or migration instance must meet the following conditions:
The Database Type of the source database is MySQL or PolarDB for MySQL, and the Database Type of the destination database is MySQL or PolarDB for MySQL.
A schema synchronization or migration task and an incremental data synchronization or migration task are included in the DTS instance.
Migration instances: Select Schema Migration and Incremental Data Migration for the Migration Types parameter.
Synchronization instances: By default, Incremental Data Synchronization is selected for the Migration Types parameter. You must also select Schema Synchronization.
When you configure a data synchronization or migration task, you can set the Source Objects to an entire database.
Usage notes
An event is only synchronized or migrated once in a single synchronization or migration task.
If incremental data tasks (Incremental Data Migration) are not included in your data migration instance, and all other conditions for migrating events are met, DTS will automatically migrate the events from the source database to the destination database.
NoteFor more information, see Task Details tab of the Schema Migration 2 module.
Procedure
The operation methods for data synchronization and migration instances are similar. This procedure uses a data synchronization instance as an example.
Configure an instance
Use one of the following methods to go to the Data Synchronization page and select the region in which the data synchronization instance resides.
DTS console
Log on to the DTS console.
In the left-side navigation pane, click Data Synchronization.
In the upper-left corner of the page, select the region in which the data synchronization instance resides.
DMS console
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 console.
Log on to the DMS console.
In the top navigation bar, move the pointer over Data Development and choose
.From the drop-down list to the right of Data Synchronization Tasks, select the region in which the data synchronization instance resides.
Click Create Task to go to the task configuration page.
Optional. Click New Configuration Page in the upper-right corner of the page.
NoteSkip this step if the Back to Previous Version button is displayed in the upper-right corner of the page.
Specific parameters in the new and previous versions of the configuration page may be different. We recommend that you use the new version of the configuration page.
Configure the source and destination database based on the actual situation.
For more information, see Overview of data synchronization scenarios or Overview of data migration scenarios for related configuration documents.
Click Test Connectivity and Proceed in the lower part of the page.
NoteMake sure that the CIDR blocks of DTS servers can be automatically or manually added to the security settings of the source and destination databases to allow access from DTS servers. For more information, see Add the CIDR blocks of DTS servers.
If the source or destination database is a self-managed database and its Access Method is not set to Alibaba Cloud Instance, click Test Connectivity in the CIDR Blocks of DTS Servers dialog box.
Select Whether to Migrate Events to Yes, and complete the subsequent operations.
For more information, see Overview of data synchronization scenarios or Overview of data migration scenarios for related configuration documents.
Synchronize events
Use one of the following methods to go to the Data Synchronization page and select the region in which the data synchronization instance resides.
DTS console
Log on to the DTS console.
In the left-side navigation pane, click Data Synchronization.
In the upper-left corner of the page, select the region in which the data synchronization instance resides.
DMS console
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 console.
Log on to the DMS console.
In the top navigation bar, move the pointer over Data Development and choose
.From the drop-down list to the right of Data Synchronization Tasks, select the region in which the data synchronization instance resides.
Find the destination instance and click the ID of the destination instance.
Optional: Click Task Management in the left-side navigation pane.
In the Progress area, click Basic Information tab of the Incremental Write module.
Click Migrate Event on the right side of the Actions.
Click OK in the pop-up Confirm dialog box.
View the details of the event synchronization task.
Uncheck Hide Completed Modules on the right side of the Progress.
Click the Schema Migration 3 module.
View the details in the Task Details tab.