MySQL Environment Preparation

  • Last update: September 05, 2024

  • Overview

    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.

    Procedure 

    Confirming the Database Version 

    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.

    Enabling the Binlog for the Database 

    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.

    iconNote:
    The enabling operation in a Linux environment is taken as an example.

    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.

    iconNote:

    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=2
    log_bin=mysql-bin
    binlog_format=ROW
    datadir=/var/lib/mysql
    socket=/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_%' 

    Granting the Specified Account Replication Privileges 

    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 STATUS
    SHOW 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 Username
    grant 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.

    show grants for Username

    Subsequent Operations 

    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.

    附件列表


    主题: Data Pipeline
    • Helpful
    • Not helpful
    • Only read

    滑鼠選中內容,快速回饋問題

    滑鼠選中存在疑惑的內容,即可快速回饋問題,我們將會跟進處理。

    不再提示

    10s後關閉

    Get
    Help
    Online Support
    Professional technical support is provided to quickly help you solve problems.
    Online support is available from 9:00-12:00 and 13:30-17:30 on weekdays.
    Page Feedback
    You can provide suggestions and feedback for the current web page.
    Pre-Sales Consultation
    Business Consultation
    Business: international@fanruan.com
    Support: support@fanruan.com
    Page Feedback
    *Problem Type
    Cannot be empty
    Problem Description
    0/1000
    Cannot be empty

    Submitted successfully

    Network busy