You can use MySQL Binlog Reader to read data from tables in your MySQL database in real time by subscribing to real-time binlogs.

Background information

MySQL Binlog Reader supports the following versions of ApsaraDB RDS for MySQL: V5.1, V5.5, V5.6, V5.7, and V8.0. It does not support MySQL for DRDS.

When the binlog writing feature is enabled for a read-only database and the binlog-format parameter is set to ROW, MySQL Binlog Reader can read data from this read-only database.

Procedure

  1. Go to the DataStudio page.
    1. Log on to the DataWorks console.
    2. In the left-side navigation pane, click Workspaces.
    3. Select the region where the required workspace resides, find the workspace, and then click Data Analytics.
  2. Move the pointer over the Create icon and choose Data Integration > Real-time synchronization.
    Alternatively, you can click the required workflow, right-click Data Integration, and then choose Create > Real-time synchronization.
  3. In the Create Node dialog box, set the Node Name and Location parameters.
    Notice The node name must be 1 to 128 characters in length. It can contain letters, digits, underscores (_), and periods (.).
  4. Click Commit.
  5. On the configuration tab of the real-time sync node, click Input > MySQL Binlog and drag MySQL Binlog to the canvas on the right.
  6. Click the MySQL Binlog component node. In the panel that appears, set the parameters in the Node configuration section.
    Reader
    Parameter Description
    Data source The connection to the MySQL Binlog data store that you have configured. In this example, you can only select a MySQL Binlog connection.

    If no connection can be used, click New data source on the right to create one on the Workspace Management > Data Source page.

    Table The name of the table from which data is to be synchronized in the specified data store. You can click Data preview on the right to preview the selected table.
    In the case of database and table sharding, data can be synchronized from multiple databases and tables in real time.
    Notice To avoid errors, the tables in database shards and table shards must use the same schema.
    Output field The fields to be synchronized, including management fields and data fields.
    • Manage fields: additional fields that are automatically added when the fields in the source tables are synchronized to the destination database. These fields facilitate data management, sorting, and deduplication.
    • Data Field: the fields in the raw tables to be synchronized.

    For more information, see Fields used for real-time synchronization.

    MySQL Binlog Reader supports database and table sharding. To use this feature, click Add a database and table data source and select the data stores and tables from the drop-down lists to synchronize data from multiple tables and databases.
    Notice To avoid errors, the selected tables must use the same schema.
  7. Click the Save icon in the toolbar.