Setting up the Apache Iceberg Sink connector
Install the Apache Iceberg Sink connector plugin on each Kafka Connect worker and configure Ranger policies so you can deploy a connector instance in Streams Messaging Manager.
Before you deploy an instance of the Apache Iceberg Sink connector, you must download and copy the connector plugin ZIP to every Kafka Connect worker. Cloudera does not automate this installation. As a standalone plugin, the connector may require additional JARs for your storage and catalog configuration. Collect the required JARs and place them in the extracted connector directory on each worker.
The connector supports Amazon S3, Azure Data Lake Storage (ADLS), and Ozone as storage backends. For catalogs, it supports Hive Metastore and JDBC catalogs.
Configure the connector entirely through the connector JSON in Streams Messaging Manager. Use iceberg.catalog.* properties for
catalog and storage settings, and iceberg.hadoop.* properties for Hive
Metastore client and Kerberos settings.
For connector properties, single message transformations (SMTs), and routing, see the Apache Iceberg Sink Connector documentation in Related information.
Import CA certificates into the Cloudera Manager Auto-TLS truststore. The required certificates depend on your storage backend:
- Amazon S3: Import all four Amazon Root CA certificates (
amazonrootca1throughamazonrootca4) into the Auto-TLS truststore. In Cloudera Manager, go to . Restart Hive and Kafka Connect on the affected hosts. - Azure ADLS: Import the DigiCert Global Root G2 or the Microsoft RSA Root Certificate Authority 2017 certificate into the Auto-TLS truststore. In Cloudera Manager, go to .
- Ozone: No additional certificate import is required.
If your cluster mounts /tmp with noexec, set the
JAVA_TOOL_OPTIONS Kafka Connect worker environment variable to
-Djava.io.tmpdir=/var/lib/kafka before you restart the
service.
On Kerberos clusters, the upstream Apache Iceberg connector's bundled Hive Metastore client
(iceberg-kafka-connect-runtime-hive, Hive 2.3.10) connects to HMS over
SASL/Kerberos on plain Thrift, not TLS on the HMS Thrift port. This connector does not
support TLS on the HMS Thrift interface combined with Kerberos SASL, and the upstream Apache
Iceberg Kafka Connect guide does not document this combination. To disable HMS Thrift SSL
in Cloudera Manager:
- On the Hive service Configuration page, add
hive.metastore.use.SSL=falseto Hive Metastore Server Advanced Configuration Snippet (Safety Valve) for hive-site.xml. - Restart Hive Metastore.
Deploy a connector instance in the Streams Messaging Manager UI. For deployment steps, see Deploying and managing Kafka Connect connectors in Streams Messaging Manager in Related information.
To automatically add new Schema Registry fields as columns in the Iceberg table, include the following property in the connector configuration:
"iceberg.tables.evolve-schema-enabled": "true"
Example configurations
Configuration examples for the Apache Iceberg Sink connector that you can import into the Streams Messaging Manager UI.
The following configurations can be imported into the Streams Messaging Manager UI.
Kerberized cluster with Auto-TLS, Hive catalog, and Amazon S3 (single table)
Replace the bracketed placeholders with your values:
{
"name": "[***CONNECTOR_NAME***]",
"config": {
"connector.class": "org.apache.iceberg.connect.IcebergSinkConnector",
"tasks.max": "1",
"topics": "[***KAFKA_TOPIC***]",
"iceberg.catalog.type": "hive",
"iceberg.catalog.uri": "thrift://[***HIVE_METASTORE_HOST***]:9083",
"iceberg.catalog.warehouse": "s3a://[***BUCKET_NAME***]/[***PATH***]/",
"iceberg.catalog.client.region": "[***AWS_REGION***]",
"iceberg.catalog.io-impl": "org.apache.iceberg.aws.s3.S3FileIO",
"iceberg.catalog.s3.access-key-id": "[***AWS_ACCESS_KEY***]",
"iceberg.catalog.s3.secret-access-key": "[***AWS_SECRET_KEY***]",
"iceberg.hadoop.hive.metastore.use.SSL": "false",
"iceberg.hadoop.hive.metastore.sasl.enabled": "true",
"iceberg.hadoop.hive.metastore.kerberos.principal": "hive/_HOST@[***REALM***]",
"iceberg.hadoop.hive.metastore.schema.verification": "false",
"iceberg.tables": "[***HIVE_DB***].[***HIVE_TABLE***]",
"iceberg.tables.auto-create-enabled": "true",
"iceberg.control.topic": "[***CONTROL_TOPIC_NAME***]",
"iceberg.control.commit.interval-ms": "60000",
"iceberg.control.commit.timeout-ms": "30000",
"key.converter": "org.apache.kafka.connect.storage.StringConverter",
"value.converter": "com.cloudera.dim.kafka.connect.converts.AvroConverter",
"value.converter.passthrough.enabled": "false",
"value.converter.schema.registry.url": "https://[***SR_HOST***]:7790/api/v1",
"value.converter.schema.registry.client.ssl.protocol": "SSL",
"value.converter.schema.registry.client.ssl.trustStorePath": "[***TRUSTSTORE_PATH***]",
"value.converter.schema.registry.client.ssl.trustStorePassword": "[***TRUSTSTORE_PASSWORD***]",
"consumer.override.sasl.mechanism": "GSSAPI",
"consumer.override.sasl.jaas.config": "com.sun.security.auth.module.Krb5LoginModule required useKeyTab=true storeKey=true keyTab=\"[***KEYTAB_PATH***]\" principal=\"[***PRINCIPAL***]@[***REALM***]\" serviceName=\"kafka\";",
"value.converter.sasl.jaas.config": "com.sun.security.auth.module.Krb5LoginModule required useKeyTab=true storeKey=true keyTab=\"[***KEYTAB_PATH***]\" principal=\"[***PRINCIPAL***]@[***REALM***]\" serviceName=\"schemaregistry\";"
}
}
Kerberized cluster with Auto-TLS, Hive catalog, and Azure ADLS
Replace the bracketed placeholders with your values:
{
"name": "[***CONNECTOR_NAME***]",
"config": {
"connector.class": "org.apache.iceberg.connect.IcebergSinkConnector",
"tasks.max": "1",
"topics": "[***KAFKA_TOPIC***]",
"iceberg.catalog.type": "hive",
"iceberg.catalog.uri": "thrift://[***HIVE_METASTORE_HOST***]:9083",
"iceberg.catalog.warehouse": "abfss://[***AZURE_STORAGE_CONTAINER***]@[***AZURE_STORAGE_ACCOUNT_NAME***].dfs.core.windows.net/[***WAREHOUSE_PREFIX***]/",
"iceberg.catalog.io-impl": "org.apache.iceberg.azure.adlsv2.ADLSFileIO",
"iceberg.hadoop-conf-dir": "/var/lib/kafka/iceberg-hadoop-conf",
"iceberg.hadoop.hive.metastore.use.SSL": "false",
"iceberg.hadoop.hive.metastore.sasl.enabled": "true",
"iceberg.hadoop.hive.metastore.kerberos.principal": "hive/_HOST@[***REALM***]",
"iceberg.hadoop.hadoop.security.authentication": "kerberos",
"iceberg.tables": "[***HIVE_DB***].[***HIVE_TABLE***]",
"iceberg.tables.auto-create-enabled": "true",
"iceberg.control.topic": "[***CONTROL_TOPIC_NAME***]",
"iceberg.control.group.id": "ctrlGroup_[***CONNECTOR_NAME***]",
"key.converter": "org.apache.kafka.connect.storage.StringConverter",
"value.converter": "com.cloudera.dim.kafka.connect.converts.AvroConverter",
"value.converter.passthrough.enabled": "false",
"value.converter.schema.registry.url": "https://[***SR_HOST***]:7790/api/v1",
"value.converter.schema.registry.client.ssl.protocol": "SSL",
"value.converter.schema.registry.client.ssl.trustStorePath": "[***TRUSTSTORE_PATH***]",
"value.converter.schema.registry.client.ssl.trustStorePassword": "[***TRUSTSTORE_PASSWORD***]",
"consumer.override.sasl.mechanism": "GSSAPI",
"consumer.override.sasl.jaas.config": "com.sun.security.auth.module.Krb5LoginModule required useKeyTab=true storeKey=true keyTab=\"[***KEYTAB_PATH***]\" principal=\"[***PRINCIPAL***]@[***REALM***]\" serviceName=\"kafka\";",
"value.converter.sasl.jaas.config": "com.sun.security.auth.module.Krb5LoginModule required useKeyTab=true storeKey=true keyTab=\"[***KEYTAB_PATH***]\" principal=\"[***PRINCIPAL***]@[***REALM***]\" serviceName=\"schemaregistry\";"
}
}
Kerberized cluster with Auto-TLS, Hive catalog, and Ozone
Replace the bracketed placeholders with your values:
{
"name": "[***CONNECTOR_NAME***]",
"config": {
"connector.class": "org.apache.iceberg.connect.IcebergSinkConnector",
"tasks.max": "1",
"topics": "[***KAFKA_TOPIC***]",
"iceberg.catalog.type": "hive",
"iceberg.catalog.uri": "thrift://[***HIVE_METASTORE_HOST***]:9083",
"iceberg.catalog.warehouse": "ofs://[***OZONE_SERVICE_ID***]/[***VOLUME***]/[***BUCKET***]/",
"iceberg.catalog.io-impl": "org.apache.iceberg.hadoop.HadoopFileIO",
"iceberg.hadoop-conf-dir": "/var/lib/kafka/iceberg-hadoop-conf",
"iceberg.hadoop.hive.metastore.use.SSL": "false",
"iceberg.hadoop.hive.metastore.sasl.enabled": "true",
"iceberg.hadoop.hive.metastore.kerberos.principal": "hive/_HOST@[***REALM***]",
"iceberg.hadoop.hadoop.security.authentication": "kerberos",
"iceberg.tables": "[***HIVE_DB***].[***HIVE_TABLE***]",
"iceberg.tables.auto-create-enabled": "true",
"iceberg.control.topic": "[***CONTROL_TOPIC_NAME***]",
"iceberg.control.group.id": "ctrlGroup_[***CONNECTOR_NAME***]",
"key.converter": "org.apache.kafka.connect.storage.StringConverter",
"value.converter": "com.cloudera.dim.kafka.connect.converts.AvroConverter",
"value.converter.passthrough.enabled": "false",
"value.converter.schema.registry.url": "https://[***SR_HOST***]:7790/api/v1",
"value.converter.schema.registry.client.ssl.protocol": "SSL",
"value.converter.schema.registry.client.ssl.trustStorePath": "[***TRUSTSTORE_PATH***]",
"value.converter.schema.registry.client.ssl.trustStorePassword": "[***TRUSTSTORE_PASSWORD***]",
"consumer.override.sasl.mechanism": "GSSAPI",
"consumer.override.sasl.jaas.config": "com.sun.security.auth.module.Krb5LoginModule required useKeyTab=true storeKey=true keyTab=\"[***KEYTAB_PATH***]\" principal=\"[***PRINCIPAL***]@[***REALM***]\" serviceName=\"kafka\";",
"value.converter.sasl.jaas.config": "com.sun.security.auth.module.Krb5LoginModule required useKeyTab=true storeKey=true keyTab=\"[***KEYTAB_PATH***]\" principal=\"[***PRINCIPAL***]@[***REALM***]\" serviceName=\"schemaregistry\";"
}
}
Dynamic table routing (fan-out)
You can enable dynamic table routing to write records to multiple Iceberg tables based on a
field value in the record. Enable dynamic routing when each record carries the fully
qualified destination table name (database.table) in a field.
Do not set the iceberg.tables property when
iceberg.tables.dynamic-enabled is set to true. With
iceberg.tables.auto-create-enabled set to true, missing
tables, and namespaces if Ranger allows, are created on the first write. Pre-create the Hive
database and grant Ranger access on [***HIVE_DB***].*.
The following Avro schema shows a field, target_table, that holds the
target table. Records must set this field to a fully qualified table name:
{
"type": "record",
"name": "UserRouted",
"namespace": "example",
"fields": [
{"name": "id", "type": "long"},
{"name": "name", "type": "string"},
{"name": "amount", "type": "double"},
{"name": "target_table", "type": "string"}
]
}
In addition to the properties described in Kerberized cluster with Auto-TLS, Hive catalog, and Amazon S3 (single table), set the following properties on the connector:
"iceberg.tables.dynamic-enabled": "true"
"iceberg.tables.route-field": "target_table"
"iceberg.tables.auto-create-enabled": "true"
"iceberg.control.topic": "[***CONTROL_TOPIC_NAME***]"
