By enabling Change Data Capture (CDC) for the data source, you can implement real-time data synchronization and DDL synchronization of data tables.
This article describes how to enable binlog-based CDC for MySQL databases. FineDataLink supports row-based logging.
Confirm that Data Pipeline supports the version of the currently used database.
Currently, only MySQL 5.5 and above non-read-only databases are supported.
You need to enable the binlog for the database in advance since the real-time synchronization task reads the MySQL database data via the binlog.
Enter the /etc directory and open the my.cnf file, as shown in the following figure.
Add the following content to the my.cnf file.
1. The operation is performed in a Linux environment. Modify the my.ini file if MySQL is deployed in a Windows environment.
2. You can set server_id to any number.
server_id=2log_bin=mysql-binbinlog_format=ROWdatadir=/var/lib/mysqlsocket=/var/lib/mysql/mysql.sock
Save the file and restart MySQL for the configuration to take effect.
Enter the following command to confirm that the value of log_bin is on, which indicates that the log has been enabled, as shown in the following figure.
show variables like 'log_%'
Enter the following command to confirm that the values of binlog_row_image and binlog_format are FULL and ROW respectively, as shown in the following figure.
show variables like 'binlog_%'
Generally, you need to grant the user account REPLICATION SLAVE and REPLICATION CLIENT privileges to allow replication.
The REPLICATION CLIENT privilege cannot be used to set up a replica. It only allows users to use the following commands.
SHOW SLAVE STATUSSHOW MASTER STATUS
1. Check the user privileges.
You can use the following command to check the privileges granted to the user.
show grants for Username
If there are no REPLICATION CLIENT or REPLICATION SLAVE privileges in the return value, assign the user the replication privileges.
2. Grant privileges using the following commands, as shown in the following figure.
grant replication client on *.* to Usernamegrant replication slave on *.* to Username
Use the following command to confirm the return value contains the following privileges, which indicates that the replication privileges are granted successfully, as shown in the following figure.
Configure the database, and then you can set up the data source.
Connect FineDataLink to the source and target databases before setting up a pipeline task for real-time synchronization. This allows you to set the data source during the task configuration by selecting its name. For details, see Data Source Creation and Management.
Complete the pipeline task setup then. For details, see Pipeline Task Configuration.
滑鼠選中內容,快速回饋問題
滑鼠選中存在疑惑的內容,即可快速回饋問題,我們將會跟進處理。
不再提示
10s後關閉
Submitted successfully
Network busy