> ## Documentation Index
> Fetch the complete documentation index at: https://docs.popsink.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Cloudera Target

> Write change events to Apache Iceberg tables on a Cloudera cluster — registered in the Hive Metastore, stored on HDFS or Ozone, secured by Kerberos and Ranger, and queried from Impala, Hive and Spark.

Popsink delivers your pipeline data to **Cloudera** as **Apache Iceberg** tables. The [Iceberg target](https://docs.popsink.com/connectors/target/iceberg.md) registers each table in the cluster's **Hive Metastore** and writes its files to **HDFS** or **Ozone**, authenticating with **Kerberos**. The tables are regular Cloudera Iceberg tables: Impala, Hive, Spark and Cloudera Data Visualization query them, and Ranger governs them, with nothing to install on the cluster.

Every change event is a row, so each table holds the source table's **change history**. The current state is read through a view. See [Current state](#current-state-of-a-table).

## Compatible versions

| | |
| - | - |
| **Cloudera** | Cloudera on premises (CDP Private Cloud Base) **7.1.9** and **7.3.1**. Cloudera on cloud data lakes on the same runtimes, with data on S3 or ADLS. |
| **Catalog** | Hive Metastore 3.1, Kerberized (SASL/GSSAPI), optionally over TLS |
| **Storage** | HDFS (with or without HA, Kerberos, data transfer protection), Ozone through its S3 Gateway, Amazon S3, ADLS Gen2 |
| **Table format** | Iceberg **v2** |
| **Readers** | Impala 4.x, Hive 3 / 4 (Hive on Tez), Spark 3 (Cloudera Data Engineering, CML), Cloudera Data Visualization |

> [!NOTE]
>
> Iceberg format v3 is disabled on Cloudera: Impala does not read it.

## How It Works

```mermaid theme={null}
flowchart LR
    K[Kafka topic] --> W[Iceberg worker]
    W -- "Kerberos (SASL)" --> H[Hive Metastore<br/>table registered]
    W -- "append (one row per change)" --> S[(HDFS or Ozone<br/>Iceberg files)]
    H --> Q[Impala, Hive,<br/>Spark]
    S --> Q
    R[Ranger] -. "policies" .-> H
    R -. "policies" .-> S
```

1. The worker obtains a Kerberos ticket from the keytab you upload, and renews it on its own.
2. It writes one Iceberg table per subscription under the warehouse path, and registers it in the Hive Metastore as an Iceberg table (`table_type=ICEBERG`, with the Hive storage handler), exactly as Cloudera's own engines do.
3. Rows are committed as Iceberg **appends**, at 10,000 rows or 60 seconds per table. Each commit takes the Hive Metastore lock on the table, so the worker can share a table with Hive, Impala or Spark writers without losing a snapshot.
4. Impala picks up new tables and new commits from the metastore's events: no `REFRESH` is needed when event polling is on (the default on Cloudera).
5. A daily maintenance job compacts small files and expires old snapshots, through the same metastore lock.

## Prerequisites

* A Kerberized Cloudera cluster with a **Hive Metastore** reachable from Popsink, and a **Hive database** for the tables (e.g. `popsink`).
* A **Kerberos principal** for Popsink (e.g. `popsink@CORP.EXAMPLE.COM`) and its **keytab**, created by your Kerberos or Active Directory administrator.
* **Ranger** policies for that principal (see [Ranger policies](#ranger-policies)).
* A **warehouse path** the principal can write to: on HDFS, e.g. `/warehouse/tablespace/external/hive/popsink.db`; on Ozone, a bucket exposed by the S3 Gateway.
* A **primary key** on each subscription whose current state you want to read: flag the key columns in the subscription's column mapping, or declare them on the datamodel.

### Network

Popsink's worker must reach, from its [egress IPs](https://docs.popsink.com/deployment/connectivity/egress-ips.md) or from inside your network for a self-hosted deployment:

| Service | Default port |
| - | - |
| Kerberos KDC | `88` (TCP and UDP) |
| Hive Metastore | `9083` |
| HDFS NameNodes | `8020` |
| HDFS DataNodes | `9866` (`1004` on clusters with privileged ports) |
| Ozone S3 Gateway | `9878` (`9879` with TLS) |

The worker reads and writes blocks directly on the DataNodes: opening the NameNode alone is not enough.

### Ranger policies

In Ranger, give the Popsink principal (or a group it belongs to):

| Service | Resource | Permissions |
| - | - | - |
| **Hadoop SQL** | database `popsink`, table `*`, column `*` | `Select`, `Create`, `Alter`, `Drop` |
| **HDFS** | the warehouse path, recursive | `Read`, `Write`, `Execute` |
| **Ozone** *(instead of HDFS)* | the volume and bucket | `Read`, `Write`, `Create`, `List`, `Delete` |

`Drop` is used by the connection test only, which creates and drops a `popsink_preflight_<random>` table. The connector never drops a table it writes to.

## Configure the target

In the console, open **Connectors → Targets**, click **New Target** and pick **Cloudera**. The tile opens the [Iceberg target](https://docs.popsink.com/connectors/target/iceberg.md) form, preset for Cloudera: catalog **Hive Metastore**, Kerberos on, storage **HDFS**, format **v2**. Once saved, the connector is listed as an Iceberg target with a *Cloudera* badge.

### Catalog

| Field | Required | Description |
| - | - | - |
| **Metastore URI** | Yes | `host:port` of a Hive Metastore, e.g. `hms01.corp.example.com:9083` |
| **Warehouse** | Yes | Where new tables are created. HDFS: `hdfs://<nameservice>/warehouse/tablespace/external/hive`. Ozone: `s3a://<bucket>/warehouse` |
| **Namespace** | Yes | The Hive database, e.g. `popsink`. One level only. |
| **Kerberos** | Yes on Cloudera | On by default from the Cloudera tile |
| **Principal** | Yes | e.g. `popsink@CORP.EXAMPLE.COM` |
| **Keytab** | Yes | The principal's keytab file. Stored as a secret and never shown back: to rotate it, upload a new one. |
| **krb5.conf** | No | Your cluster's `krb5.conf`, when the realm's KDCs are not discoverable through DNS |
| **Metastore principal** *(advanced)* | No | Defaults to `hive/_HOST@<REALM>`, the realm taken from **Principal** |
| **TLS to the metastore** | No | On when the metastore has `hive.metastore.use.SSL=true` |
| **CA certificate** | No | PEM bundle that signed the metastore's certificate, when it is not a public CA |

> [!TIP]
>
> Use the realm exactly as in the keytab, upper case. `klist -kt popsink.keytab` lists the principals a keytab holds.

### Storage

> [tab] HDFS
>
> Pick **Storage Credentials → Static credentials of this connector → HDFS**.
>
> | Field | Required | Description |
> | - | - | - |
> | **Nameservice** | Yes | The HA nameservice (`dfs.nameservices`), or the NameNode host on a non-HA cluster |
> | **NameNodes** | Yes | One `host:port` per NameNode, e.g. `nn01.corp.example.com:8020`, `nn02.corp.example.com:8020` |
> | **Data transfer protection** *(advanced)* | No | Must match the cluster's `dfs.data.transfer.protection`: none, `integrity` or `privacy` |
> | **Use the metastore's Kerberos identity** | No | On by default. Turn it off to write the files with another principal and keytab. |
>
> The warehouse must be an `hdfs://<nameservice>/…` path.

> [tab] Ozone
>
> The worker reaches Ozone through its **S3 Gateway**. Pick **Storage Credentials → Static credentials of this connector → S3 or S3-compatible**.
>
> | Field | Value |
> | - | - |
> | **S3 Endpoint** | The S3 Gateway, e.g. `https://s3g.corp.example.com:9879` |
> | **Path-style addressing** | On |
> | **S3 Access Key ID** / **S3 Secret Access Key** | The secret Ozone generates for the principal: `ozone s3 getsecret --om-service-id=<service-id>` run as `popsink` |
>
> The warehouse must be an `s3a://<bucket>/…` path, the scheme Impala and Hive resolve on Cloudera. The bucket must be visible through the gateway (in the `s3v` volume, or linked into it).

> [tab] S3 or ADLS (Cloudera on cloud)
>
> On a Cloudera on cloud data lake, the tables live in the environment's S3 bucket or ADLS container. Configure the storage exactly as on the [Iceberg target](https://docs.popsink.com/connectors/target/iceberg.md#storage-credentials): an IAM role or access key for S3 (with an `s3a://` warehouse), a service principal for ADLS (with an `abfs://` warehouse). The catalog is the data lake's Hive Metastore, with Kerberos as above.

### Connection test

**Test** walks the steps the worker walks, and prefixes any failure with the step that failed:

| Prefix | What was checked |
| - | - |
| `[auth]` | A ticket was obtained from the keytab, and the metastore accepted the Kerberos session. A clock skew, an unknown realm or a principal missing from the keytab are reported as such. |
| `[namespace]` | The Hive database exists (or may be created), and a `popsink_preflight_<random>` table can be created and dropped. A Ranger denial is reported with Ranger's message. |
| `[storage]` | A `popsink-preflight-<random>` file can be written and deleted under the warehouse, on HDFS or through the Ozone S3 Gateway |

Save the target, then create a subscription for each source table. Each one creates its table on the first commit.

## Querying the tables

Tables appear in the Hive database as soon as their first batch is committed:

```sql Impala theme={null}
SHOW TABLES IN popsink;
DESCRIBE HISTORY popsink.orders;   -- Iceberg snapshots
SELECT count(*) FROM popsink.orders;
```

If Impala's metastore event processing is off (`hms_event_polling_interval_s = 0`), run `INVALIDATE METADATA popsink.orders` once for a new table, and `REFRESH popsink.orders` to see new commits.

### What is written

The table holds the subscription's mapped columns plus `__op` and `__ts_ms`, and, with metadata columns on, `__kafka_partition`, `__kafka_offset`, `__kafka_timestamp` and `__ingested_at`. See [What Is Written](https://docs.popsink.com/connectors/target/iceberg.md#what-is-written).

| Iceberg type | Impala | Hive |
| - | - | - |
| `boolean`, `int`, `long` | `BOOLEAN`, `INT`, `BIGINT` | `boolean`, `int`, `bigint` |
| `float`, `double` | `FLOAT`, `DOUBLE` | `float`, `double` |
| `decimal(p, s)` | `DECIMAL(p,s)` | `decimal(p,s)` |
| `date` | `DATE` | `date` |
| `timestamptz` (µs, UTC) | `TIMESTAMP` (UTC) | `timestamp with local time zone` |
| `string` (text, JSON, times) | `STRING` | `string` |

Iceberg types are chosen as on the [Iceberg target](https://docs.popsink.com/connectors/target/iceberg.md#column-types). The connector never writes the Iceberg types Impala cannot read (`time`, `uuid`, `fixed`): times and UUIDs are written as `string`.

> [!WARNING]
>
> Impala reads a `timestamptz` column as a `TIMESTAMP` in UTC. To show local time, convert explicitly: `from_utc_timestamp(__ingested_at, 'Europe/Paris')`.

## Current state of a table

The Iceberg table is the change history: an update or a delete adds a row. To read one row per key, create a view that keeps the latest change of each key and hides deleted keys. The rules are detailed under [Current state: the merge view](https://docs.popsink.com/connectors/target/iceberg.md#current-state-the-merge-view).

```sql Impala theme={null}
CREATE VIEW popsink.orders_current AS
SELECT id, status, amount, __op, __ts_ms   -- list your columns
FROM (
  SELECT
    *,
    ROW_NUMBER() OVER (
      PARTITION BY id
      ORDER BY __ts_ms DESC, __kafka_offset DESC
    ) AS _ppsk_rank
  FROM popsink.orders
) history
WHERE _ppsk_rank = 1
  AND (__op IS NULL OR __op <> 'd');
```

The view is stored in the Hive Metastore, so Hive and Spark read it too. Replace `id` with your primary key columns, and drop the `__kafka_offset` tie-breaker if metadata columns are off on the subscription. Keep the delete filter **after** the ranking: filtering deletes first would bring a deleted row's previous version back.

> [!TIP]
>
> For large tables read often, materialize the view on a schedule (`CREATE TABLE … STORED BY ICEBERG AS SELECT … FROM orders_current` in a Cloudera Data Engineering or Oozie job) and point dashboards at the copy.

## Table maintenance

The [maintenance job](https://docs.popsink.com/connectors/target/iceberg.md#table-maintenance) runs daily on Cloudera as on any other catalog: compaction, snapshot expiry, orphan cleanup and, optionally, purge of deleted keys. It authenticates with the same keytab and commits through the metastore lock, so it never races the worker or your own jobs.

If your team already runs Iceberg maintenance from Spark (`rewrite_data_files`, `expire_snapshots`), keep one of the two: turn off maintenance on the connector, or exclude Popsink's database from your jobs.

## Limitations

* Iceberg format **v2** only, for Impala.
* The current-state view is created and maintained by you: the managed merge view is available on Snowflake only.
* Kerberos is the only authentication to the metastore: LDAP or Knox-only access is not supported.
* Ozone is reached through its S3 Gateway only: `ofs://` and `o3fs://` paths are not supported.
* One Hive database per connector. A Hive database is one namespace level.
* Columns are never dropped or retyped. Nested records and arrays are written as JSON text. See the [Iceberg target limitations](https://docs.popsink.com/connectors/target/iceberg.md#limitations).

## FAQ

> [accordion] Do I need to install anything on the cluster?
>
> No. Popsink writes standard Iceberg tables through the Hive Metastore's own API, and the Kerberos principal, the keytab and the Ranger policies are all it needs.

> [accordion] Can Popsink and a Spark job write to the same table?
>
> Yes. Every commit takes the Hive Metastore lock on the table, like Cloudera's engines, so concurrent commits are serialized and none is lost. Keep the columns Popsink writes under its control: a column renamed or retyped by another writer stops the subscription on that table.

> [accordion] Why are my tables not visible in Impala?
>
> Check that Impala's metastore event processing is on. If it is off, run `INVALIDATE METADATA <db>.<table>` for a new table and `REFRESH <db>.<table>` for new commits.

> [accordion] The connection test fails with a clock skew error
>
> Kerberos refuses tickets when clocks differ by more than five minutes. On a self-hosted deployment, synchronize the nodes running Popsink with your cluster's NTP servers.

> [card] [Iceberg target](https://docs.popsink.com/connectors/target/iceberg.md)
>
> Every option of the connector behind the Cloudera target.

> [card] [Target data types](https://docs.popsink.com/connectors/target/data-types.md)
>
> Compare column types across every target.

> [card] [Start a pipeline](https://docs.popsink.com/quickstart.md)
>
> End-to-end example to validate your configuration.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.