Configure the Hive Metastore (HMS) client in hive-site.xml to
connect Hive to an external Iceberg REST catalog.
By default, Hive uses the ThriftHiveMetaStoreClient class to communicate with the Hive Metastore. To connect Hive directly to an external Iceberg REST catalog, you must replace the default metastore client implementation with HiveRESTCatalogClient and define the catalog type and uniform resource identifier (URI) endpoint in the hive-site.xml file.
You have a running external Iceberg REST catalog service endpoint.
You have administrative access to edit the hive-site.xml configuration file.
Open the hive-site.xml configuration file in a text editor.
Set the metastore.client.impl property to org.apache.iceberg.hive.client.HiveRESTCatalogClient to replace the default Thrift metastore client.
Set the metastore.catalog.default property to your target catalog identifier, such as ice01.
Set the iceberg.catalog.catalog_name.type property to
rest.
Set the iceberg.catalog.catalog_name.uri property to the HTTP or
HTTPS endpoint of your REST catalog service.
The following example shows the required properties in
hive-site.xml for a catalog named ice01:
If your REST catalog service requires OAuth2 authentication, configure the authentication type, OAuth2 token endpoint, and client credentials in hive-site.xml.
Add the following OAuth2 authentication properties for the catalog:
Save the hive-site.xml file and restart the Hive service to apply the changes.
Hive routes metadata requests to the configured Iceberg REST catalog. To override the default catalog on a per-table basis, include the iceberg.catalog table property when creating a table, as shown in the following SQL example:
CREATE TABLE ice_orc (
first_name STRING,
last_name STRING
)
STORED BY ICEBERG STORED AS ORC
TBLPROPERTIES('iceberg.catalog'='ice01');