All Products
Search
Document Center

Hologres:Replicate binlog with Flink or Blink

Last Updated:Mar 26, 2026

Realtime Compute for Apache Flink can consume Hologres binary logs (binlogs) in real time, enabling change data capture (CDC) pipelines from Hologres to downstream systems. This topic covers the source table DDL syntax for both non-CDC and CDC modes, how to migrate from Holohub mode to JDBC (Java Database Connectivity) mode, and how to identify Flink jobs that need upgrading before you upgrade your Hologres instance.

Prerequisites

Before you begin, make sure you have:

  • A Hologres instance running V0.9 or later

  • Binary logging enabled on the target table. For details, see Subscribe to Hologres binary logs

  • Ververica Platform (VVP) 2.4 or later for real-time binlog consumption via the Hologres connector

Limitations

  • Binary logging is supported at the table level for row-oriented, column-oriented, and (from Hologres V1.1) row-column hybrid storage tables.

  • Column-oriented tables have higher write overhead than row-oriented tables when binary logging is enabled. For tables with frequent updates, use row-oriented storage.

  • Binary logs cannot be consumed from parent partitioned tables.

  • Engine whitelists require Hologres V1.3.21 or later. If you enable a whitelist on an earlier version, binlog consumption fails.

  • CDC mode source tables do not support watermark definitions. For window aggregation, use non-window aggregation instead.

  • Holohub mode is deprecated as of Hologres V2.1 and fully replaced by JDBC mode. See Switch from Holohub mode to JDBC mode.

  • If your instance is earlier than the required version, contact the Hologres team via online support.

Permissions

ModeRequired permissions
Holohub modeRead and write permissions on the target table. Custom accounts are not supported.
JDBC modeInstance superuser or Owner on the target table + Replication Role on the instance. Custom accounts are supported.

For JDBC mode, the hg_binlog extension must also exist on the instance. This extension is created by default in Hologres V2.0 and later. For setup details, see Consume Hologres binary logs using JDBC.

Binlog system fields

All binlog source tables expose three system metadata fields. Their names and types are fixed and cannot be changed.

FieldTypeDescription
hg_binlog_lsnBIGINTLog sequence number — the position of the event in the binary log
hg_binlog_event_typeBIGINTThe type of change event (INSERT, DELETE, UPDATE_BEFORE, or UPDATE_AFTER). In non-CDC mode, use this field to determine how to handle each row.
hg_binlog_timestamp_usBIGINTThe timestamp of the event, in microseconds
All user-defined fields in a binlog source table must use lowercase column names.

Consume binlogs in non-CDC mode

In non-CDC mode, all binlog records arrive as Flink INSERT rows. The hg_binlog_event_type field carries the original change type, and your downstream logic decides how to handle each event.

After enabling binary logging on a Hologres table, define the source table with the following DDL:

CREATE TABLE test_message_src_binlog_table (
  hg_binlog_lsn          BIGINT,
  hg_binlog_event_type   BIGINT,
  hg_binlog_timestamp_us BIGINT,
  id                     INTEGER,
  title                  VARCHAR,
  body                   VARCHAR
) WITH (
  'connector'            = 'hologres',
  'dbname'               = '<your-database>',
  'tablename'            = '<your-table>',
  'username'             = '<your-access-key-id>',
  'password'             = '<your-access-key-secret>',
  'endpoint'             = '<your-vpc-endpoint>',
  'binlog'               = 'true',
  'binlogMaxRetryTimes'  = '10',
  'binlogRetryIntervalMs'= '500',
  'binlogBatchReadSize'  = '100'
);

Replace the placeholders with your actual values:

PlaceholderDescriptionExample
<your-database>The Hologres database namemy_db
<your-table>The Hologres table nameorders
<your-access-key-id>Your AccessKey IDLTAI5tXxx...
<your-access-key-secret>Your AccessKey secretxXxXxXx...
<your-vpc-endpoint>The VPC endpoint of your Hologres instance<instance-id>-cn-hangzhou.hologres.aliyuncs.com:80

Connector parameters

ParameterRequiredDescription
connectorYesMust be hologres
dbnameYesHologres database name
tablenameYesHologres table name
usernameYesAccessKey ID
passwordYesAccessKey secret
endpointYesVPC endpoint of the Hologres instance
binlogYesSet to true to enable binlog consumption
binlogMaxRetryTimesNoMaximum retry attempts on failure. Example value: 10
binlogRetryIntervalMsNoInterval between retries, in milliseconds. Example value: 500
binlogBatchReadSizeNoNumber of records to read per batch. Example value: 100
cdcModeNoSet to true to enable CDC mode
sdkModeNoSet to jdbc to switch to JDBC mode

Consume binlogs in CDC mode

In CDC mode, Flink automatically maps each binlog record to an accurate RowKind (INSERT, DELETE, UPDATE_BEFORE, or UPDATE_AFTER) based on hg_binlog_event_type. This mirrors table changes similarly to CDC from MySQL or PostgreSQL, and is useful for replicating Hologres table data to downstream sinks.

The DDL is the same as non-CDC mode, with two differences:

  • Omit the three binlog system fields from the schema — Flink manages them internally.

  • Add 'cdcMode' = 'true' to the WITH clause.

CREATE TABLE test_message_src_binlog_table (
  id    INTEGER,
  title VARCHAR,
  body  VARCHAR
) WITH (
  'connector'            = 'hologres',
  'dbname'               = '<your-database>',
  'tablename'            = '<your-table>',
  'username'             = '<your-access-key-id>',
  'password'             = '<your-access-key-secret>',
  'endpoint'             = '<your-vpc-endpoint>',
  'binlog'               = 'true',
  'cdcMode'              = 'true',
  'binlogMaxRetryTimes'  = '10',
  'binlogRetryIntervalMs'= '500',
  'binlogBatchReadSize'  = '100'
);
CDC mode source tables do not support watermark definitions. For time-based window aggregation, see MySQL/Hologres CDC source tables do not support window functions.

Consume both full and incremental data

Starting from Ververica Runtime (VVR) engine 1.13-vvr-4.0.13 and Hologres V0.10, CDC source tables support a combined full + incremental mode. The job first reads all existing data from the table, then automatically switches to consuming incremental binlog records without any gap. For configuration details, see Hologres connector.

Use JDBC mode

Starting from Flink 6.0.3, binlog consumption is also available in JDBC mode. JDBC mode supports more data types and custom Hologres accounts, making it more flexible than Holohub mode. For configuration details, see Hologres connector.

Switch from Holohub mode to JDBC mode

Hologres has been phasing out Holohub mode since V2.0, and fully replaced it with JDBC mode in V2.1. Before upgrading your Hologres instance, upgrade your Flink VVR jobs first.

Upgrade to Hologres V2.1

Choose one of the following solutions based on your current VVR version:

(Recommended) Solution 1: Upgrade VVR to 8.0.7 or later

Flink automatically switches from Holohub mode to JDBC mode. No additional configuration is needed.

Solution 2: Upgrade VVR to 6.0.7–8.0.5

  1. Add 'sdkMode'='jdbc' to each binlog source table DDL.

  2. Restart the Flink job.

  3. Grant the Flink job user one of the following permission sets:

    • Instance superuser permission

    • Owner permission on the target table + CREATE DATABASE permission + Replication Role permission for the instance

  4. Confirm that the job runs correctly.

  5. Upgrade the Hologres instance.

(Not recommended) Solution 3: Upgrade VVR to 8.0.6

Flink automatically switches to JDBC mode. However, VVR 8.0.6 has a known issue: if a dimension table has too many fields, the VVR job may time out during deployment. For details, see Hologres Connector Release Note. Use Solution 1 instead.

Upgrade to Hologres V2.0

(Recommended) Solution 1: Upgrade VVR to 8.0.6 or later

Flink automatically switches to JDBC mode. Use VVR 8.0.7 or later to avoid the known dimension table issue in VVR 8.0.6. For details, see Hologres Connector Release Note.

Solution 2: Upgrade VVR to 8.0.4 or 8.0.5

  1. Grant the Flink job user one of the following permission sets:

    • Instance superuser permission

    • Owner permission on the target table + CREATE DATABASE permission + Replication Role permission for the instance

  2. Restart the Flink job and verify it runs correctly.

  3. Upgrade the Hologres instance.

Solution 3: Upgrade VVR to 6.0.7–8.0.3

Flink continues to use Holohub mode. No mode switch is required.

Find jobs that need upgrading

If you have many Flink VVR jobs, use the following tool to identify which jobs and tables need to be upgraded before migrating.

This tool supports SQL jobs (DDL-based table definitions) and Catalog jobs (hint-based parameters). It does not support JAR jobs or Catalog tables without hint parameters.

Step 1: Download the tool

Download find-incompatible-flink-jobs-1.0-SNAPSHOT-jar-with-dependencies.jar.

Step 2: Run the scan

Requires JDK 8 or later.

java -cp find-incompatible-flink-jobs-1.0-SNAPSHOT-jar-with-dependencies.jar \
  com.alibaba.hologres.FindIncompatibleFlinkJobs \
  <region> <url> <AccessKeyID> <AccessKeySecret> <binlog|rpc>

Example:

java -cp find-incompatible-flink-jobs-1.0-SNAPSHOT-jar-with-dependencies.jar \
  com.alibaba.hologres.FindIncompatibleFlinkJobs \
  Beijing \
  https://vvp.console.aliyun.com/web/xxxxxx/zh/#/workspaces/xxxx/namespaces/xxxx/operations/stream/xxxx \
  my-access-key-id \
  my-access-key-secret \
  binlog

Parameters:

ParameterDescription
regionThe region of the Realtime Compute for Apache Flink project. See the region value table below.
urlThe URL of any job in the target Flink project.
AccessKeyIDThe AccessKey ID of an account with access to the Flink project.
AccessKeySecretThe AccessKey secret of that account.
binlog | rpcbinlog: scans all binlog source tables in the project. rpc: scans all dimension tables and sink tables that use RPC mode.

Region values:

RegionValue
China (Beijing)Beijing
China (Shanghai)Shanghai
China (Hangzhou)Hangzhou
China (Shenzhen)Shenzhen
China (Zhangjiakou)Zhangjiakou
China (Hong Kong)Hong Kong
SingaporeSingapore
Germany (Frankfurt)Germany
Indonesia (Jakarta)Indonesia
Malaysia (Kuala Lumpur)Malaysia
US (Silicon Valley)US
Shanghai Finance CloudShanghai Finance Cloud

Step 3: Review the results

The tool outputs a list of jobs and tables that require upgrading.

image

What's next