Synchronization from MySQL to Kafka
This section uses MySQL to MRS Kafka synchronization as an example to describe how to configure a synchronization task.
Prerequisites
- You have logged in to the DRS console.
- Your account balance is greater than or equal to ¥0.
- For details about real-time synchronization, see Real-Time Synchronization.
- For details about constraints on DRS usage, see Before You Start.
Procedure
- On the Data Synchronization Management page, click Create Synchronization Task.
- On the Select Scenario page, select Source Database Type and Destination Database Type and click Next.
In this example, the source database can be Databases on the current cloud. The destination database can be On-premises databases, Self-built databases on ECS, Databases on the current cloud, or Databases on other cloud.
- On the Create Synchronization Instance page, configure the task details, recipients, description, and the synchronization instance, and click Next. Figure 1 Synchronization task information
Table 1 Task and recipient description Parameter
Description
Task Name
The task name consists of 4 to 50 characters, starts with a letter, and can contain only letters (case-insensitive), digits, hyphens (-), and underscores (_).
Send Notifications
This parameter is optional. If this function is enabled, DRS will send notifications to specified recipients based on the mobile numbers and email addresses you provided. If an exception occurs during synchronization, the system will send a notification to the specified recipients.
NOTE:Recipients must confirm the subscription on the SMN console within 48 hours of receiving an SMS message or email. Otherwise, they cannot receive notifications from DRS.
Synchronization Delay Threshold
During an incremental synchronization, a synchronization delay indicates a time difference (in seconds) of synchronization between the source and destination database.
If the synchronization delay exceeds the threshold you specify, DRS will send alarms to the specified recipients. The value ranges from 1 to 3,600. To avoid repeated alarms caused by the fluctuation of delay, an alarm is sent only after the delay has exceeded the threshold for six minutes.
NOTE:- In the early stages of an incremental synchronization, the synchronization delay is long because a large quantity of data is awaiting synchronization. In this case, no notifications will be sent.
- Before setting the delay threshold, you need to enter the recipient's mobile number or email address.
Description
The description consists of a maximum of 256 characters and cannot contain the following special characters: !=<>'&"
Figure 2 Synchronization instance information
Table 2 Synchronization instance information Parameter
Description
Data Flow
Select Out of the cloud.
Source DB Engine
Select MySQL.
Destination DB Engine
Select Kafka.
Network Type
The Public network is used as an example. Available options: Public network, VPC, VPN or Direct Connect
Destination DB Instance
Created Kafka instance
Synchronization Instance Subnet
Select the subnet where the synchronization instance is located. You can also click View Subnet to go to the network console to view the subnet where the instance resides.
By default, the DRS instance and the destination DB instance are in the same subnet. You need to select the subnet where the DRS instance resides, and there are available IP addresses for the subnet. To ensure that the synchronization instance is successfully created, only subnets with DHCP enabled are displayed.
Synchronization Mode
Incremental
Through log parsing, incremental data generated on the source database is synchronized to the destination database in real time.
During synchronization, the source database continues to provide services for external systems with zero downtime.
- On the Configure Source and Destination Databases page, wait until the synchronization instance is created. Then, specify source and destination database information and click Test Connection for both the source and destination databases to check whether they have been connected to the synchronization instance. After the connection tests are successful, select the check box before the agreement and click Next. Figure 3 Source database information
Table 3 Source database information Parameter
Description
DB Instance Name
The RDS DB instance you selected when creating the synchronization task and cannot be changed.
Database Username
The username for accessing the source database.
Database Password
The password for the database username.
The username and password of the source database are encrypted and stored in DRS and will be cleared after the task is deleted.
Figure 4 Destination database information
Table 4 Source database information Parameter
Description
IP Address or Domain Name
The IP address or domain name of the source database.
- On the Set Synchronization Task page, select the synchronization object and click Next. Figure 5 Synchronization mode
Table 5 Synchronization object Parameter
Description
Topic
Select the topic to be synchronized to the destination database.
Synchronization Object
Select Tables.
DRS supports database- and table-level synchronization. You can select data for synchronization based on your service requirements.
- On the Check Task page, check the synchronization task.
- If any check fails, review the failure cause and rectify the fault. After the fault is rectified, click Check Again.
For details about how to handle check failures, see the Checking Whether the Source Database Is Connected section in the Data Replication Service User Guide.
- If all check items are successful, click Next. Figure 6 Task check
You can proceed to the next step only when all check items are successful. If any alarms are generated, view and confirm the alarm details first before proceeding to the next step.
- If any check fails, review the failure cause and rectify the fault. After the fault is rectified, click Check Again.
- On the Confirm Task page, specify Start Time, confirm that the configured information is correct, select the check box before the agreement, and click Next.
- Set Start Time to Start upon task creation or Start at a specified time based on site requirements.
- After a synchronization task is started, the performance of the source and destination databases may be affected. You are advised to start a synchronization task during off-peak hours.
- After the task is submitted, you can view and manage it on the Data Synchronization Management page.
- You can view the status of the task that has been submitted. For details about the task status, see Task Status.
- You can click
in the upper-right corner to view the latest task status.
Last Article: Synchronization from Oracle to GuassDB(for MySQL) Primary/Standby Edition
Next Article: Kafka Message Format
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.