You can use a real-time ETL synchronization task to synchronize data from sources such as DataHub and Hologres to Kafka. The task initializes the Kafka topic based on the source table schema and continuously synchronizes data for downstream consumption.
Limits
The version of the Kafka data source must range from 0.10.2 to 3.6.0.
The version of the Hologres data source must be V2.1 or later.
Incremental synchronization of data from a Hologres partitioned table is not supported.
Messages for DDL changes on a Hologres table cannot be synchronized.
Incremental data of the following data types can be synchronized from Hologres: INTEGER, BIGINT, TEXT, CHAR(n), VARCHAR(n), REAL, JSON, SERIAL, OID, INT4[], INT8[], FLOAT8[], BOOLEAN[], TEXT[], and JSONB.
You must enable binary logging for the Hologres table in the source Hologres database. For more information, see Subscribe to Hologres binlogs.
Prerequisites
A Serverless resource group is purchased.
Hologres and Kafka data sources are created. For more information, see Create a data source for Data Integration.
Network connectivity between the resource group and the data sources is established. For more information, see Network connectivity solutions.
Procedure
1. Select a synchronization task type
Log on to the DataWorks console. In the target region, click in the left-side navigation pane. Select a workspace from the drop-down list and click Go to Data Integration.
In the left-side navigation pane, click Sync Tasks. At the top of the page, click Create synchronization task and configure the following parameters.
Data Source And Destination:
Hologres→KafkaNew Task Name: Customize a name for the synchronization task.
Synchronization Mode:
single-table real-time.Synchronization Mode Step: Select
full synchronization.
2. Configure network and resources
In the Configure Network Connections and Resource Groups section, select the Resource Group for the synchronization task. You can also set the Task Resource Usage in CUs.
For Source Data Source, select a
Hologresdata source. For Destination data source, select aKafkadata source. Then, click Test Connection.Once the connectivity tests for the source and destination data sources pass, click Next step.
3. Configure the synchronization link
a. Configure the Hologres source
At the top of the page, click the Hologres data source and edit the Holo source information.

In the Holo source information section, select the source schema and table.
In the upper-right corner, click Data Sampling.
In the Preview Data Output dialog box, specify the Sampled Data Records and click Start Collection. This samples and previews data from the Hologres table.
b. Configure the Kafka destination
At the top of the page, click the Kafka destination and edit Kafka Destination Information.

In the Kafka Destination Information section, select the Kafka topic to which you want to write data.
Set Merge Source Binlog Update Messages as needed. If you enable this option, the two update messages that correspond to an update operation in the source binary logs are merged into one message before they are written to Kafka.
Configure Output Format, Key Column, and Kafka Producer Parameters.
Output Format: Specifies the value format for records written to Kafka. Valid formats are Canal CDC and JSON. For more information, see Appendix: Output formats.
Key Column: Specifies source columns whose values are serialized into strings and concatenated with commas to form the key for records written to the Kafka topic.
NoteThe serialization rules for column values are the same as the JSON serialization rules for column data types in Hologres.
The key values in the Kafka topic determine the partitions to which data is written. Data with the same key value is written to the same partition. To ensure that a consumer can consume data in the Kafka topic in sequence, we recommend that you use the primary key columns of the Hologres table as the key columns.
If no source column is used as the key column, the key values in the Kafka topic are null. In this case, data is written to random partitions in the Kafka topic.
Kafka Producer Parameters: These parameters control consistency, stability, and exception handling for write operations. The default configuration is sufficient for most use cases. For information about the producer parameters supported by different Kafka versions, see the official Kafka documentation.
4. Alerts
To prevent task errors from causing delays in business data synchronization, you can set an alert policy for the synchronization task.
-
Click Alert Settings in the upper-right corner of the page to open the Alert Rule Configurations for Real-time Synchronization Subnode settings page.
-
Click Add Alert Rule to configure an alert rule.
NoteThe alert rules you define here apply to the real-time synchronization subtasks that this task generates. After you configure the task, you can view and modify the alert rules for these subtasks on the Run and manage real-time synchronization tasks page.
-
Manage alert rules.
For existing alert rules, you can use the toggle switch to enable or disable them. You can also send alerts to different recipients based on the alert level.
5. Advanced settings
The synchronization task provides several parameters that you can modify as needed.
Before making changes, ensure that you fully understand the function of each parameter to prevent unexpected errors or data quality issues.
-
Click advanced settings in the upper-right corner of the page to open the advanced settings page.
-
On the advanced settings page, modify the parameter values as needed.
6. Resource group
You can click Configure Resource Group in the upper-right corner to view and switch the task's current resource group.
7. Execute the synchronization task
-
After completing all settings, click Complete at the bottom of the page.
-
On the page, find the task you created and click Start in the Operations column.
-
Click the Name/ID of the corresponding task in the Task List to view its detailed execution process.
Perform O&M operations on the synchronization task
View the status of the synchronization task
After the synchronization task is created, go to the Tasks page to view all synchronization tasks in the workspace and their basic information.
The task list displays the following columns: Name/ID, Data Source Synchronization Solution (synchronization type, source, and destination), Status, Execution Overview, resource group, and Actions.
You can Start or Stop a synchronization task in the Actions column. Under More, you can perform other operations, such as Edit and View.
For started tasks, you can view the basic running status in the Execution Overview and click the corresponding overview area to view the execution details.
A real-time synchronization task from a Hologres table to Kafka consists of the following three steps:
Structure Migration: includes the creation method of the destination table (existing table or automatic table creation). If you select automatic table creation, the data definition language (DDL) statement for creating the table is displayed.
Full initialization: If you select Full Sync for the synchronization step of your task, the full initialization progress is displayed here.
Real-time Data Synchronization: Contains statistics about real-time synchronization, including real-time read/write traffic, dirty data, failovers, and operation logs.
Rerun a task
In special cases, such as when you need to modify synchronized fields or adjust target table information, you can click Rerun in the Operations column of the synchronization task. This action synchronizes the adjusted fields and other changes to the target. The process skips unchanged, previously synchronized tables.
-
To run the task again without any changes, click Rerun.
-
If you edit the task, click Complete after making your changes. The task's action changes to Apply Updates. Clicking Apply Updates reruns the task with the new configuration.
Appendix: Description of output formats
Canal CDC
Canal CDC is a CDC data format defined by Alibaba Canal.
Json
The JSON format uses Hologres binary log field names as keys and serializes field values into strings. The resulting key-value pairs are written to the Kafka topic as JSON-formatted strings.