Iceberg connector
Iceberg Sink Connector overview
Apache Iceberg Sink Connector — sink connector for writing data from Kafka to Iceberg tables.
Using Iceberg Sink Connector provides the following benefits:
-
Message coordination for centralized Iceberg commits.
-
Ensuring exactly once delivery semantic.
-
Ability to fork across multiple tables.
-
Automatic table creation and schema evolution.
-
Field name mapping using Iceberg column mapping functionality.
To illustrate the benefits of the connector, the article shows an implementation of a full pipeline using Kafka Connect — capturing change data (CDC) in PostgreSQL database tables with writing changes to an Iceberg table.
Prerequisites for the ADH and ADS clusters and the description of the Iceberg Sink Connector configuration are provided below separately for each available storage: Hadoop Distributed File System (HDFS) and Apache Ozone (O3).
Prerequisites
The environment used to create a complete CDC pipeline is described below.
ADH
-
The ADH cluster is installed according to the Online installation guide. The minimum ADH version is 3.3.6.2.b1.
-
The Core configuration, Zookeeper, HDFS, ADPG, Hive, HUE, and Impala services are added and installed in the ADH cluster.
-
In ADH, the
kafka-connectuser is created on each host and has rights to create tables in the HDFS storage (as a member of thehadoopgroup), for example, as shown below:$ sudo adduser kafka-connect $ sudo usermod -aG hadoop kafka-connect
-
The ADH cluster is installed according to the Online installation guide. The minimum ADH version is 3.3.6.2.b1.
-
The Core configuration, Zookeeper, HDFS, ADPG, Hive, Ozone, HUE, and Impala services are added and installed in the ADH cluster.
-
In ADH, the
kafka-connectuser is created on each host and has rights to create tables in the HDFS storage (as a member of thehadoopgroup), for example, as shown below:$ sudo adduser kafka-connect $ sudo usermod -aG hadoop kafka-connect -
For the described example, on the host where Ozone is installed, a volume and a bucket are created:
$ ozone sh volume create volumetest $ sudo ozone sh bucket create /volumetest/testbucket -
The configuration of ADH services for integration with Ozone is completed as described below. In all specified configurations,
<ozone.om.service.ids>is used — the value of the corresponding parameter of the Ozone Manager component (ozone-site.xml parameter group) of the Ozone service in the ADH cluster, configured during cluster installation.-
Core configuration
Set the
ofs://<ozone.om.service.ids>/value for the fs.defaultFS parameter in the core-site.xml group to define the default filesystem name. -
YARN
Set the
ofs://<ozone.om.service.ids>/system/yarn/node-labelsvalue for the yarn.node-labels.fs-store.root-dir parameter in the yarn-site group to define the NodeLabelManager URI. -
Hive
Set the
ofs://<ozone.om.service.ids>/volumetest/testbucketvalue for the hive.metastore.warehouse.dir parameter in the hive-site.xml group to define the location of the default database for the storage, where/volumetest/testbucketis an Ozone volume and bucket, existing in Ozone or created specifically above.
-
It is recommended to configure ADH cluster services during the cluster installation (before executing the Install action). Changing configuration for the installed services does not guarantee stable operation of Iceberg Sink Connector when using the Ozone storage.
ADS and ADS Control
-
The ADS cluster is installed according to the Online installation guide. The minimum ADS version is 3.7.2.1.b1.
-
Kafka, Kafka Connect, and Schema-Registry services are added and installed in the ADS cluster.
-
To automatically create a Kafka topic, the auto.create.topics.enable parameter is enabled in the server.properties group when configuring the Kafka service.
-
When configuring the Kafka Connect service, a new value
/usr/lib/kafka-connect/pluginshas been added to the plugin.path parameter group in the connect-distributed.properties parameter as shown below.
Configuring the path to the Iceberg Sink Connector pluginSetting the plugin path is required only for ADS 3.7.2.1.b1.
-
The configuration of the ADH cluster used in the pipeline is imported into the ADS cluster.
To enable import, on the Import tab of the ADS cluster, select Cluster configuration next to the name of the ADH cluster and click Import.
Import of ADH dataAs a result of the import, the /etc/kafka folder should contain the ADH configuration files: core-site-xml and hdfs-site-xml.
-
The ADS Control cluster is installed according to the Installation guide and integrated with the ADS cluster being used.
-
The ADS cluster is installed according to the Online installation guide. The minimum ADS version is 3.9.1.2.b1.
-
The Zookeeper, Kafka, Kafka Connect, and Schema-Registry services are added and installed in the ADS cluster.
-
To automatically create a Kafka topic, the auto.create.topics.enable parameter is enabled in the server.properties group when configuring the Kafka service.
-
The configuration of the ADH cluster used in the pipeline is imported into the ADS cluster.
To enable import, on the Import tab of the ADS cluster, select Cluster configuration next to the name of the ADH cluster and click Import.
Import of ADH dataAs a result of the import, the /usr/lib/kafka/config/ folder should contain the ADH configuration files: core-site-xml and hdfs-site-xml.
The import of the ADH cluster configuration should be performed after configuring ADH services for integration with Ozone.
-
The ADS Control cluster is installed according to the Installation guide and integrated with the ADS cluster being used.
ADPG
-
The ADPG cluster is installed according to the Online installation guide.
-
PostgreSQL server IP address (a host with the ADPG service) is
10.92.43.42. For incoming connections, the default port number is5432. -
To create a Debezium connector, similar to the one described in the Debezium Connector for PostgreSQL server article, the ADPG cluster settings are set via ADCM UI (configuring access to the database from the Kafka Connect host in the pg_hba.conf file and the wal_level parameter in the postgresql.conf file).
Below is an example of creating and configuring a PostgreSQL database (in the ADPG cluster).
Connect to the database as the postgres user and run the psql utility:
$ sudo -i -u postgres
$ psql
Create a database:
CREATE DATABASE my_database;
Connect to the database:
\c my_database
Create a user with the SUPERUSER role:
CREATE USER my_user WITH SUPERUSER PASSWORD 'P@ssword';
|
CAUTION
The SUPERUSER user role is used for testing purposes only. For more information, see Configuring permissions for the Debezium connector.
|
Create a test table:
CREATE TABLE my_table (
id BIGSERIAL PRIMARY KEY,
name VARCHAR(100) NOT NULL,
country VARCHAR(100),
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
Configure replica identification for a table to enable the use of BIGSERIAL PRIMARY KEY indexes on the subscriber side for row lookups:
ALTER TABLE my_table REPLICA IDENTITY FULL;
Fill the table with data (given as an example, several lines are needed for clarity):
INSERT INTO my_table(name, country) VALUES ('John Jones','USA');
|
NOTE
|
Create a Debezium connector for PostgreSQL server
To capture row-level data changes in PostgreSQL database tables using ADS Control, create a Debezium connector similar to the one described in the article Debezium connector for PostgreSQL server.
Below is an example Debezium connector configuration with a description of the new parameters used in the data pipeline.
{
"name": "cdc-my-adpg",
"topic.prefix": "cdc__demo",
"connector.class": "io.debezium.connector.postgresql.PostgresConnector",
"publication.autocreate.mode": "filtered",
"database.user": "my_user",
"database.dbname": "my_database",
"tasks.max": 1,
"database.port": 5432,
"plugin.name": "pgoutput",
"database.hostname": "10.92.43.42",
"database.password": "P@ssword",
"table.include.list": ["public.my_table"],
"value.converter.schema.registry.url": "http://10.92.42.130:8081",
"value.converter": "io.confluent.connect.avro.AvroConverter",
"key.converter.schema.registry.url": "http://10.92.42.130:8081",
"key.converter": "io.confluent.connect.avro.AvroConverter",
"transforms": ["unwrap"],
"transforms.unwrap.type": "io.debezium.transforms.ExtractNewRecordState",
"transforms.unwrap.add.fields": "op,source.schema,source.table,source.ts_ms,ts_ms",
"transforms.unwrap.add.headers": "db",
"transforms.unwrap.delete.handling.mode": "rewrite",
"slot.name": "cdc__my_database",
"schema.evolution": "basic"
}
| Attribute | Description |
|---|---|
value.converter.schema.registry.url |
Schema-Registry server address |
key.converter.schema.registry.url |
Schema-Registry server address |
transforms.unwrap.type |
Specifies the class used for the |
transforms.unwrap.add.fields |
Additional fields to add to the data |
transforms.unwrap.add.headers |
Defines whether to add metadata to the Kafka message header |
transforms.unwrap.delete.handling.mode |
Defines how to handle deletion events. |
table.include.list |
Optional list of comma-separated regular expressions that match the table IDs of the tables whose changes are to be captured. If this property is set, the connector captures changes only from the specified tables. Each ID must be of the form
|
slot.name |
Name of the PostgreSQL logical decoding slot created for streaming. The server uses this slot to stream events to the Debezium connector. Must be unique for each connector connecting to the database |
schema.evolution |
Specifies the schema evolution mode. When set to |
Create an Iceberg connector
To create an Iceberg connector via ADS Control, the connector plugin IcebergSinkConnector is used.
To create connectors using the ADS Control, you need to:
-
Go to the Kafka Connects page in the ADS Control web interface. The Kafka Connects page becomes available after selecting a cluster in the cluster management section and going to the desired tab on the General page.
-
Select the desired cluster and go to the Kafka Connect instance overview page.
-
Click Create Connector on the Kafka Connect instance overview page. After clicking Create Connector, the window for selecting the connector plugin Clusters → <cluster name> → Kafka Connects → <cluster name> connector → Kafka connector plugins opens.
-
Select the desired connector to create.
Selecting a plugin to create a connector
Selecting a plugin to create a connector -
Fill in the connector configuration parameters. If necessary, use the parameter information:
-
in the Kafka Connect configuration parameters article;
-
in the Iceberg connector configuration.
You can fill in the configuration in the form of a JSON file. To do this, enable the JSON view switch.
Connector configuration
Connector configuration
Connector configuration JSON file
Connector configuration JSON fileExample contents of a JSON file with an Iceberg connector configuration with HDFS{ "connector.class": "org.apache.iceberg.connect.IcebergSinkConnector", "iceberg.tables.cdc-field": "__op", "tasks.max": 1, "topics": [ "cdc__demo.public.my_table" ], "iceberg.tables.upsert-mode-enabled": true, "iceberg.control.commit.interval-ms": 30000, "iceberg.catalog.uri": "thrift://10.92.43.153:9083", "iceberg.connect.hdfs.keytab": "/etc/security/keytabs/kafka-connect.service.keytab", "iceberg.tables.auto-create-enabled": true, "value.converter.schema.registry.url": "http://10.92.42.130:8081", "iceberg.connect.hdfs.principal": "kafka-connect/sov-ads-6.ru-central1.internal@ADS-KAFKA.LOCAL", "iceberg.tables": [ "default.my_table" ], "name": "iceberg-sink-cdc-connector", "iceberg.tables.schema-case-insensitive": true, "iceberg.catalog.warehouse": "hdfs://adh/apps/hive/warehouse", "value.converter": "io.confluent.connect.avro.AvroConverter", "iceberg.tables.default-id-columns": "id", "iceberg.hdfs.authentication.kerberos": true, "iceberg.catalog.type": "hive", "key.converter": "io.confluent.connect.avro.AvroConverter", "key.converter.schema.registry.url": "http://10.92.42.130:8081", "iceberg.write.format.default": "parquet", "iceberg.hadoop-conf-dir": "/etc/kafka/" }Example contents of a JSON file with an Iceberg connector configuration with Ozone{ "connector.class": "org.apache.iceberg.connect.IcebergSinkConnector", "iceberg.tables.cdc-field": "__op", "tasks.max": 1, "topics": [ "cdc__demo.public.my_table" ], "iceberg.tables.upsert-mode-enabled": true, "iceberg.control.commit.interval-ms": 30000, "iceberg.catalog.uri": "thrift://10.92.38.137:9083", "iceberg.connect.hdfs.keytab": "/etc/security/keytabs/kafka-connect.service.keytab", "iceberg.tables.auto-create-enabled": true, "value.converter.schema.registry.url": "http://10.92.38.143:8081", "iceberg.connect.hdfs.principal": "kafka-connect/sov-ads-6.ru-central1.internal@ADS-KAFKA.LOCAL", "iceberg.tables": [ "default.my_table" ], "name": "iceberg-sink-cdc-connector", "iceberg.tables.schema-case-insensitive": true, "iceberg.catalog.warehouse": "ofs://adh2/volumetest/testbucket", "value.converter": "io.confluent.connect.avro.AvroConverter", "iceberg.tables.default-id-columns": "id", "iceberg.hdfs.authentication.kerberos": true, "iceberg.catalog.type": "hive", "key.converter": "io.confluent.connect.avro.AvroConverter", "key.converter.schema.registry.url": "http://10.92.38.143:8081", "iceberg.write.format.default": "parquet", "iceberg.hadoop-conf-dir": "/usr/lib/kafka/config/" }The description of the Iceberg Sink Connector parameters used in the examples is given below.
Description of parameters for configuring the Iceberg Sink ConnectorAttribute Description name
Name of the connector that will be used in the Kafka Connect service
connector.class
Class name for the connector
tasks.max
Maximum number of tasks to create
topics
Name of the topic whose data should be passed to the Iceberg tables. For the CDC pipeline implementation, the topic name has the form
<topic.prefix>.<table.include.list>, consisting of the parameters of the Debezium connector created aboveiceberg.tables
Comma-separated list of target tables
iceberg.write.format.default
Default file format for a table:
parquet,avro, ororciceberg.tables.auto-create-enabled
Set to
trueto automatically create target tablesiceberg.tables.schema-case-insensitive
Set to
trueto search for table columns by name in a case-insensitive mannericeberg.tables.upsert-mode-enabled
Set the value to
trueto enable UPSERT modeiceberg.tables.cdc-field
The field of the source record that identifies the type of operation (
INSERT,UPDATE, orDELETE) when UPSERT mode is enablediceberg.tables.default-id-columns
A list of default comma-separated columns that define the identifier row in tables (primary key). Is a mandatory parameter when UPSERT mode is enabled
iceberg.catalog.type
Type of a catalog for storing Iceberg tables
iceberg.catalog.uri
Address to connect to the catalog with Iceberg tables (address of the host with the Hive Metastore component installed)
iceberg.hdfs.authentication.kerberos
Flag for enabling/disabling HDFS Kerberos authentication (disabled by default). Used when Kerberos authentication is enabled in ADS and ADH. Available starting from ADS 3.9.0.1.b1
iceberg.connect.hdfs.principal
The name of the Kerberos principal to be used in authentication. It is a mandatory parameter if Kerberos authentication is enabled. Available starting from ADS 3.9.0.1.b1
iceberg.connect.hdfs.keytab
The path to the keytab file for Kerberos, which contains the key for the principal. It is a mandatory parameter if Kerberos authentication is enabled. Available starting from ADS 3.9.0.1.b1
iceberg.hadoop-conf-dir
Path to Kafka broker configuration files
iceberg.catalog.warehouse
Path to metadata storage. Must match the value of the hive.metastore.warehouse.dir parameter in the hive-site.xml group for Hive
key.converter
Converter type for message key
key.converter.schema.registry.url
Schema-Registry server address
value.converter
Converter type for message value
value.converter.schema.registry.url
Schema-Registry server address
iceberg.control.commit.interval-ms
Interval between commits in ms
-
-
After filling, click Save and get a message about the successful creation of the connector.
Message about the successful creation of the connector
Message about the successful creation of the connector -
On the opened page, launch the connector using the
icon .
-
Check that the launched connector is in a working status.
Created and launched connector
Created and launched connectorIf after creating the connector the task is created with an error, the contents of the error can be seen after clicking
located in the Status field of the task.
PostgreSQL database table data in ADS Control
The Topics page of the ADS Control user interface displays a topic with all PostgreSQL table fields and their contents created by the Debezium connector.
The ADS Control user interface page Schema-Registry displays the schemas created in Schema-Registry for table keys and values.
The schemas tab displays a description of all table fields, including fields added using the transforms.unwrap.add.fields parameter when creating the Debezium connector.
As a result of creating the data pipeline, in the connectors table on the Kafka Connect instance overview page, both connectors created have the same topic name in the Topic column.
Iceberg tables
To test change collection using the Debezium connector, make changes to the PostgreSQL table:
INSERT INTO my_table(name, country) VALUES ('NAME','COUNTRY');
After connecting to the user interface of the HUE service from the ADH cluster, you can view Iceberg tables created by the connector.
The path to the directory where the table is located is specified on the Databases → default → my_table → Details tab as the Location parameter and matches the value of the hive.metastore.warehouse.dir parameter in the hive-site.xml group of the Hive ADH service parameters.
For a table placed in Ozone, messages and metadata can be viewed on the Ozone page in the HUE UI in the corresponding volume and bucket.
UPSERT mode
Starting from ADS 3.9.0.1.b1, there is an option to specify parameters to enable and configure the UPSERT mode in the Iceberg Sink Connector configuration.
After enabling the UPSERT mode (using the connector parameter iceberg.tables.upsert-mode-enabled), any changes to the Iceberg tables are made in accordance with the following rules:
-
Each operation is an
UPSERT— a combination ofDELETEandINSERToperations. The row is updated in the Iceberg table with the same identifier as in the incoming record. If the row is not found, a record is simply added. This allows for inserting, updating, or deleting records in a single operation without overwriting data. -
If there is a field in the Kafka record indicating the type of operation being performed (
INSERT,UPDATE, orDELETE) and this operation type is specified as the value of the connector parametericeberg.tables.cdc-field, then these operations are executed independently of each other (as they would have been performed without enabling the UPSERT mode). When a new record is attempted, the connector will match the value of the Kafka record operation field with the value of theiceberg.tables.cdc-fieldparameter, and if they match, it will apply this operation to the incoming row. The function for specifying the type of operation can be used when retrieving data from CDC platforms.Users can also configure the values of the
iceberg.tables.cdc-fieldparameter, corresponding to various operations, by applying the following options:-
iceberg.tables.cdc.ops.insert -
iceberg.tables.cdc.ops.update -
iceberg.tables.cdc.ops.delete
Example of specifying options in the connector configuration:
{ "iceberg.tables.cdc-field": "__op", "iceberg.tables.cdc.ops.insert": "c,r", "iceberg.tables.cdc.ops.update": "u", "iceberg.tables.cdc.ops.delete": "d", "iceberg.tables.upsert-mode-enabled": "true", "iceberg.tables.default-id-columns": "id" } -
-
If a Kafka record contains a field specifying the type of operation being performed (
INSERT,UPDATE, orDELETE), and this operation type is listed as the value for the connector parametericeberg.tables.cdc.ops.ignored, then the connector will simply ignore the incoming record.
|
NOTE
Currently, the |
The parameters of the UPSERT mode are described below, as well as the version of ADS starting from which these parameters can be applied.
| Parameter | Description | Default value | ADS version |
|---|---|---|---|
iceberg.tables.upsert-mode-enabled |
Set the value to |
false |
|
iceberg.tables.cdc-field |
The field of the source record that identifies the type of operation ( |
__op |
|
iceberg.tables.default-id-columns |
A list of default comma-separated columns that define the identifier row in tables (primary key). Is a mandatory parameter |
— |
|
iceberg.tables.cdc.ops.insert |
Comma-separated values of the CDC operation field that correspond to |
r,c |
|
iceberg.tables.cdc.ops.update |
Comma-separated values of the CDC operation field that correspond to |
u |
|
iceberg.tables.cdc.ops.delete |
Comma-separated values of the CDC operation field that correspond to |
d |
|
iceberg.tables.cdc.ops.ignored |
Comma-separated values of the CDC operation field that should be ignored by the connector |
t,m |
Deletion vectors
Starting with ADS 4.0.0.b1, deletion vectors are supported for Iceberg v3 tables.
Deletion vectors (DVs) — the row deletion mechanism introduced in Apache Iceberg Spec v3, which uses a Roaring Bitmap attached directly to data files for data deletion, reducing redundant reading and metadata overhead for tables with frequent updates.
For Iceberg v3 tables, setting the write.delete.mode and write.update.mode parameters to merge-on-read enables deletion vectors when deleting and updating records.
Table metadata encryption
Starting with ADS 4.0.0.b1, Iceberg table encryption is supported, including:
-
Encryption of manifest list key metadata when using StandardEncryptionManager.
-
Caching of encryption keys (1-hour TTL) to reduce load on Key Management Service (KMS).
-
AES GCM streaming encryption; the encrypted file length is recorded in the key metadata to protect against attacks.
To support encryption functionality for an Iceberg table/catalog, the Iceberg catalog/table parameters should be configured:
-
encryption.type = standard— enables the standard encryption type. -
encryption.kms-impl— specifies the path to KMS client custom classes. -
encryption.key-id— specifies the identifier of the master key used to encrypt and decrypt the table. Master keys are stored and managed in the KMS.
OpenMetadata
Starting with ADS 4.1.0.b1, you can track metadata and the lineage of Apache Iceberg tables via the OpenMetadata server.
Below is a description of the Iceberg Sink Connector configuration option using HDFS storage and OpenMetadata, as well as a description of the connector parameters used to connect to OpenMetadata.
|
NOTE
The configuration example is given for OpenMetadata version 2.0 and above. |
How to configure OpenMetadata
-
Install OpenMetadata using one of the methods suggested in the official documentation.
-
Connect to OpenMetadata.
-
In OpenMetadata, open the Settings → Services → Add New Service page, create the services one by one, and connect the created services to the ADH and ADS cluster services as described below.
To connect to the Iceberg server, deployed on the Hive service from ADH, OpenMetadata uses the Hive service. To quickly find the service you need, use the search bar.
Select the Hive service and fill in the fields:
-
Service Name — the name of the service. The name you enter must match the value of the
iceberg.metadata.iceberg-service-nameparameter specified when creating a connector. -
Host and Port — for the host name, enter the host where the HiveServer component is installed on ADH, and for the port, enter
10000.
Connect using the Test Connection button. If the connection is successful, in the Connection status pop-up window, click Done.
Click Next: What to Ingest. On the next page, select the databases, schemas, and tables to collect metadata from.
Click Create & Deploy to create a service instance. Once the page for the created Database Services → hive service opens, go to the Agents tab and start Metadata Agent using the Run button. On the Databases tab, you can view the created databases and their contents.
To connect to Kafka and Schema-Registry services from the ADS package in OpenMetadata, the Kafka service is used. For a quick search of the required service, use the search bar, as shown above for Hive.
Select the Kafka service and fill in the fields:
-
In the Connection section:
-
Service Name — the service name. The entered name must match the value of the
iceberg.metadata.kafka-service-nameparameter specified when creating the connector. -
Bootstrap Servers — the comma-separated
bootstrap serversvalues of the Kafka service from ADS.
-
-
In the Scope & Options section, the Schema Registry URL field — the link to connect to the Schema-Registry service of the ADS cluster.
Connect using the Test Connection button. If the connection is successful, click Done in the Connection status pop-up.
Click Next: What to Ingest. On the next page, choose the topics for metadata collection.
Click Create & Deploy to create a service instance. Once the page for the created Messaging Services → kafka service opens, go to the Agents tab and start the Metadata Agent using the Run button. On the Topics tab, you can view the topics that have been created.
To connect to the Kafka Connect service from the ADS suite in OpenMetadata, the Kafka Connect service is used. To quickly find the service you need, use the search bar, as shown above for Hive.
Select the Kafka Connect service and fill in the fields:
-
Service Name — the name of the service. The entered name must match the value of the
iceberg.metadata.pipeline-service-nameparameter, specified when creating the connector. -
Host and Port — use the host where the Kafka Connect Worker component is installed on ADH as the host name, and use the
rest.portparameter value (default is8083) as the port.
Use the Test Connection button to connect. If the connection is successful, click Done in the Connection status pop-up window.
Click Next: What to Ingest. On the next page, choose the connectors for collecting metadata.
Click Create & Deploy to create a service instance. Once the page for the created Pipeline Services → kafka-connect service opens, go to the Agents tab and start the Metadata Agent using the Run button.
Create a connector
Iceberg Sink Connector with OpenMetadata connection is available for creation in ADS Control in the way that was described above using additional parameters.
{
"name": "iceberg-sink-cdc-connector",
"connector.class": "org.apache.iceberg.connect.IcebergSinkConnector",
"tasks.max": 1,
"topics": ["cdc__demo.public.my_table"],
"iceberg.tables": ["default.my_table"],
"iceberg.write.format.default": "parquet",
"iceberg.tables.auto-create-enabled": true,
"iceberg.tables.schema-case-insensitive": true,
"iceberg.tables.upsert-mode-enabled": true,
"iceberg.tables.cdc-field": "__op",
"iceberg.tables.default-id-columns": "id",
"iceberg.catalog.type": "hive",
"iceberg.catalog.uri": "thrift://10.111.35.140:9083",
"iceberg.hadoop-conf-dir": "/etc/kafka/",
"iceberg.catalog.warehouse": "hdfs://adh/apps/hive/warehouse",
"key.converter": "io.confluent.connect.avro.AvroConverter",
"key.converter.schema.registry.url": "http://10.111.47.24:8081",
"value.converter": "io.confluent.connect.avro.AvroConverter",
"value.converter.schema.registry.url": "http://10.111.47.24:8081",
"iceberg.control.commit.interval-ms": 30000,
"metadata.reporter.openmetadata.token": "TOKEN",
"metadata.reporter.openmetadata.max.retries": "0",
"metadata.reporter.openmetadata.flush.interval.ms": "1000",
"metadata.reporter.class": "org.apache.kafka.connect.openmetadata.OpenMetadataReporter",
"metadata.reporter.openmetadata.url": "http://10.111.47.31/:8585/",
"iceberg.metadata.iceberg-service-name": "hive",
"iceberg.metadata.iceberg-database-name": "default",
"iceberg.metadata.pipeline-service-name": "kafka-connect",
"iceberg.metadata.kafka-service-name": "kafka"
}
The description of the additional Iceberg Sink Connector parameters for connecting to OpenMetadata is provided below.
| Parameter | Description | Default value |
|---|---|---|
metadata.reporter.openmetadata.token |
Token for authentication in the OpenMetadata API. You can get the token in the OpenMetadata interface on the Settings → Services → Bots page after selecting IngestionBot |
null |
metadata.reporter.openmetadata.max.retries |
The maximum number of retry attempts for temporary network errors and HTTP request errors |
3 |
metadata.reporter.openmetadata.flush.interval.ms |
Interval between attempts to process the background buffer, in milliseconds |
10000 |
metadata.reporter.class |
Implementation class of MetadataReporter. Use |
— |
metadata.reporter.openmetadata.url |
The base URL of the OpenMetadata server. The |
— |
metadata.reporter.openmetadata.verify.ssl |
Enables TLS certificate verification for OpenMetadata HTTP requests |
true |
metadata.reporter.openmetadata.request.timeout.ms |
HTTP request timeout in OpenMetadata, in milliseconds |
30000 |
metadata.reporter.openmetadata.buffer.size |
The maximum number of metadata events stored in memory. New events are lost when the buffer is full |
1000 |
metadata.reporter.openmetadata.batch.size |
The maximum number of metadata events processed in one batch |
50 |
metadata.reporter.openmetadata.retry.backoff.ms |
Initial pause before retrying in milliseconds. The pause doubles after each attempt, up to 30 seconds |
500 |
metadata.reporter.openmetadata.entity.not.available.retry.timeout.minutes |
The maximum time to retry an event if the specified OpenMetadata entity is unavailable. The timeout is measured from the event’s timestamp. Set to 0 for unlimited retries |
1440 |
iceberg.metadata.iceberg-service-name |
The OpenMetadata database service name used to build Iceberg table FQNs |
— |
iceberg.metadata.iceberg-database-name |
The OpenMetadata database name used to create full Iceberg table names |
default |
iceberg.metadata.pipeline-service-name |
The name of the OpenMetadata pipeline service. The connector name is added to it to form the pipeline’s FQN |
kafka-connect |
iceberg.metadata.kafka-service-name |
The name of the OpenMetadata messaging service used to build Kafka topic FQNs |
kafka |
When the connector launches successfully, you can view the data lineage for the created connectors on the Lineage page in OpenMetadata. To do this, you need to create a new entry in the source table, as shown above.
Static routing topic-to-table
Static routing is the routing of Kafka topics to Iceberg tables in Kafka Connect for Iceberg Sink Connector.
Static routing of topics to tables is useful when a single connector handles many Kafka topics, but the destination Iceberg table is known for each topic. In this mode, the connector does not route records based on a list of tables, a regular expression, or a field value. Instead, it performs an exact lookup by the Kafka topic name.
How routing works
Topic-to-table routing
To enable topic-to-table routing mode, set the routing.strategy parameter when creating the connector:
{
"routing.strategy": "topic-to-table"
}
Below are the values for the routing.strategy parameter used when configuring the connector.
| Value | Description | Required connector parameters |
|---|---|---|
all-tables |
Routes each record to every table listed in |
iceberg.tables |
regex |
Routes records by matching |
iceberg.tables, iceberg.tables.route-field, per-table |
dynamic-field |
Routes each record to the table with the name stored in |
iceberg.tables.route-field |
topic-to-table |
Routes records by the exact Kafka topic name using a configured topic-to-table mapping, as described below. Topic names are not treated as regular expressions or prefixes |
One of the parameters: |
The behavior of the connector when receiving sink task records after setting routing.strategy to topic-to-table is described below:
-
The Kafka topic name is extracted from the incoming
SinkRecord. -
An exact match of the topic name is searched for in the configured topic-to-table mapping.
-
The record is written to the corresponding Iceberg table if the topic is found.
-
The record is skipped if the topic is not in the mapping.
Default routing
If routing.strategy is not set, the connector uses the default routing resolution for different conditions (combinations of parameters) listed below.
| Condition | Routing behavior |
|---|---|
The |
Routes topics to the table named from the |
The |
Routes using regex patterns that can be customized for each table |
None of the above conditions are met |
Routes each record to all tables listed in |
Mapping sources
If the routing.strategy parameter is set to topic-to-table, you need to configure one of the mapping parameters listed below for the connector. The connector won’t start during task startup if both parameters are selected or if none of them are selected.
| Parameter | Description |
|---|---|
iceberg.tables.topic-to-table-mapping |
Built-in mapping with tables listed through commas, for example: |
iceberg.tables.topic-to-table-mapping-file |
Mapping using a local JSON file by specifying the absolute path to it |
Built-in map
Use built-in mapping for small sets of routes:
{
"name": "events-sink",
"config": {
"connector.class": "org.apache.iceberg.connect.IcebergSinkConnector",
"topics": "sales-topic,logs-topic",
"routing.strategy": "topic-to-table",
"iceberg.tables.topic-to-table-mapping": "sales-topic:prod.sales,logs-topic:prod.logs",
"iceberg.catalog.type": "rest",
"iceberg.catalog.uri": "http://iceberg:8181"
}
}
The built-in mapping format is hard to maintain because with a large number of routes, Kafka Connect’s configuration limits can be exceeded.
Map in the file
Create a JSON file specifying the topic-to-table mapping with a comma for large sets of routes:
{
"version": 1,
"routes": {
"sales-topic": "prod.sales",
"logs-topic": "prod.logs"
}
}
Specify the path to the file in the connector configuration:
{
"name": "events-sink",
"config": {
"connector.class": "org.apache.iceberg.connect.IcebergSinkConnector",
"topics": "sales-topic,logs-topic",
"routing.strategy": "topic-to-table",
"iceberg.tables.topic-to-table-mapping-file": "/etc/iceberg/topic-table-routes.json",
"iceberg.catalog.type": "rest",
"iceberg.catalog.uri": "http://iceberg:8181"
}
}
The file path should be an absolute local path on each host with the Kafka Connect Worker component in ADS.
Here’s how the connector behaves when using a JSON mapping file:
-
The mapping file is loaded and checked when sink tasks start. Incorrect configuration or wrong file contents will cause a configuration error and prevent the task from starting.
-
Once running, the connector keeps the mapping in memory. Routing each record doesn’t read the file, it just looks it up in memory by topic name.
-
Changes in the JSON file aren’t loaded automatically. To apply changes, you need to restart or reconfigure the connector so that Kafka Connect starts new tasks with the updated file.
The mapping file should follow these rules:
-
The file should be in JSON format without comments.
-
The root value should be a JSON object.
-
The
versionfield should be present and be the integer1. -
The
routesfield should be a non-empty JSON object. -
The keys in the
routesfield are Kafka topic names, and they should be non-empty strings with no spaces at the beginning or end. -
The values in the
routesfield are Iceberg table identifiers, and they should be non-empty strings with no spaces at the beginning or end. -
Each table identifier should be valid for Iceberg parsing.
-
Duplicate topic keys are rejected when the connector runs.