Configuring writing to Apache Iceberg tables with Cloudera Harmony Catalog
Cloudera Data Flow writes data from Apache NiFi flows to Apache Iceberg tables managed by Cloudera Harmony Catalog on Cloudera Anywhere Cloud.
Cloudera Data Flow can write records from Apache NiFi flows to managed
Apache Iceberg tables using Cloudera Harmony Catalog, which is powered by
Apache Polaris. Cloudera Harmony Catalog deployed in Cloudera Anywhere Cloud exposes an Iceberg REST Catalog interface secured
with OAuth authentication over TLS/SSL and governed by Apache Ranger authorization
policies. To connect a NiFi flow to Cloudera Harmony Catalog, you obtain
OAuth client credentials from Anywhere Cloud Console, configure
controller services for OAuth token retrieval and REST catalog connectivity by using the
pre-created Default NiFi SSL Context Service, and configure the
PutIceberg processor to write to your target namespace and
table.
Principal binding and Apache Ranger authorization
The Anywhere Cloud Console user that you log in as when generating OAuth client credentials determines what your NiFi flow is authorized to access in Cloudera Harmony Catalog. Client credentials are permanently bound to that user's principal. When a NiFi processor connects to Cloudera Harmony Catalog, Apache Ranger evaluates authorization policies against this bound principal instead of a separate client identity.
Ensure that the user account used to generate credentials exists in Ranger and is
assigned to the required policies in the harmony-catalog service.
For production data flows, Cloudera
recommends logging in to Anywhere Cloud Console by using a dedicated
identity provider account configured with only the Ranger permissions that your flow
requires.
Prerequisites
Ensure that your environment meets the following prerequisites before configuring Cloudera Harmony Catalog connectivity in Flow Designer:
- Cloudera Data Flow is deployed in Cloudera Anywhere Cloud, and your user account has the
cdf-flow-adminrole assigned for that instance. - You have created a flow draft in Flow Designer (an active test session is optional unless you want to enable controller services and validate live writes in Flow Designer). For instructions, see Creating a new draft and Starting a test session.
- Cloudera Harmony Catalog is deployed in Cloudera Anywhere Cloud. For more information, see Deploying Cloudera Harmony Catalog on Anywhere Cloud
- A catalog, namespace, and target Iceberg table have been created in Cloudera Harmony Catalog.
- Your Anywhere Cloud Console user account is assigned to the
required Apache Ranger policies in the
harmony-catalogservice, including table read and write permissions and table property read, write, remove, and set permissions.
Configuration workflow
Connecting a NiFi flow in Flow Designer to Cloudera Harmony Catalog involves the following tasks:
- Generate an OAuth
client_idandclient_secretpair from Anywhere Cloud Console. For instructions, see Access keys and API tokens. - Configure a
StandardOauth2AccessTokenProvidercontroller service to retrieve OAuth access tokens. - Configure a
RESTCatalogServicecontroller service that references your Cloudera Harmony Catalog URI, warehouse, OAuth token provider, and the Default NiFi SSL Context Service. - Configure a
PutIcebergprocessor to write records to your Iceberg table throughRESTCatalogService.
Creating an OAuth2 access token provider service
Configure a StandardOauth2AccessTokenProvider controller service in Cloudera Data Flow Flow Designer to retrieve OAuth bearer tokens for Cloudera Harmony Catalog authentication.
The StandardOauth2AccessTokenProvider controller service
authenticates against the Anywhere Cloud Console OAuth token endpoint
by using your client_id and client_secret
credentials and supplies bearer tokens to the RESTCatalogService
controller service.
- You generated and recorded an OAuth
client_idandclient_secretpair from Anywhere Cloud Console, and you know your Anywhere Cloud Console domain (for example,my-awc.example.comwhen your console URL ishttps://console.my-awc.example.com). For instructions, see Access keys and API tokens. - You opened your flow draft in Cloudera Data Flow Flow Designer.
Creating a RESTCatalogService controller service
Configure a RESTCatalogService controller service in Cloudera Data Flow Flow Designer to connect Apache NiFi processors to Cloudera Harmony Catalog.
Apache Iceberg processors in Flow Designer delegate catalog metadata requests, TLS
encryption, OAuth authentication, and storage credential vending to a
RESTCatalogService controller service. This service combines
your Cloudera Harmony Catalog URI and warehouse name with your
StandardOauth2AccessTokenProvider instance and the pre-created
Default NiFi SSL Context Service.
- You recorded the secure URI and warehouse name for your Cloudera Harmony Catalog instance. To retrieve the secure URI in Anywhere Cloud Console,
- Go to .
- Locate your Cloudera Harmony Catalog instance and view instance details.
- Copy the external API endpoint and append it with
/api/catalog:
For example:https://[***HARMONY INSTANCE***]-harmony-catalog-api.[***AWC CLUSTER***].[***DOMAIN***]/api/cataloghttps://my-harmony-instance-harmony-catalog-api.my-awc-cluster.mycompany.com/api/catalog
- You created and configured the
StandardOauth2AccessTokenProvidercontroller service in your Flow Designer draft (and enabled it if you have an active test session).
Configuring the PutIceberg processor
Configure the PutIceberg processor on the Cloudera Data Flow Flow Designer canvas to write records to Apache Iceberg tables through Cloudera Harmony Catalog.
After you configure RESTCatalogService, you can reference it in the
PutIceberg processor on the Flow Designer canvas to write
incoming record-oriented FlowFiles to your target Apache Iceberg table.
- You created and configured the
RESTCatalogServicecontroller service in your Flow Designer draft (and enabled all required controller services if you have an active test session).
