ByteHouse Cloud Data Warehouse VersionUser guideData modelingExternal CatalogHive Catalog
Copy page
Download PDF
External Catalog
Hive Catalog
Copy page
Download PDF
Hive Catalog
ByteHouse cloud data warehouse edition supports integrating Hive Catalog. You do not need to manually create external databases or tables; you can query Hive data via Hive Catalog. This article will introduce how to create and use Hive Catalog.
When ByteHouse accesses the Hive cluster, it must have privileges to access the Hive metadata storage (metastore) service. Currently, ByteHouse supports the following metadata storage services:
Standard Hive metastore
LAS Formation from BytePlus AI Data Lake Service LAS
The method for creating Hive Catalog varies depending on the metadata storage service used; you can select the corresponding method according to your actual service. Additionally, ByteHouse also experimentally supports AWS Glue Datacatalog, which you can create as needed.
Please obtain the following privileges and connection information according to the metadata storage type used by your Hive.
Metadata storage service type
Required permissions and connection information
S3-compatible object storage service
Obtain the access permissions for the S3-compatible object storage service used by Hive.
Connection address for Hive metadata storage.
Access Key ID (AK)/Secret Access Key (SK) with access permissions to the S3-compatible object storage service. If you are using the BytePlus object storage service TOS, see Access Key (key) management for how to obtain it.
The endpoint of the S3-compatible object storage service. If you are using the BytePlus object storage service TOS, see Region and URL Full Domain (Endpoint) for how to obtain it.
LAS
Access permissions for the LAS Catalog, as well as database and table-level read and write permissions. For configuration details, see LAS access control.
Connection information:
The endpoint and access keys (Access Key ID (AK)/Secret Access Key (SK)) for the TOS service used by LAS.
endpoint: You can log in to the TOS Console and view the required endpoint via Bucket List > Bucket Name > Overview > URL Full Domain path. For a list of common endpoints, see the S3 Endpoint column in Region and URL Full Domain (Endpoint).
The region where the physical data center of the TOS (Volcano Engine Object Storage Service) used by LAS is located. For a list of common regions, see Region and URL Full Domain.
Hive uses different metadata services, and the corresponding parameter configuration will also be different. This section will introduce the method for creating Hive Catalog by metadata service type.
Replace {catalogName} with your custom catalog name.
Catalog param
type='hive': Set to hive.
metastore_type: Set to hive.
hive_metastore_uri: The connection address of the Hive Metastore service. The format and example are as follows:
Format: thrift://hive_thrift_server_ip:port, where <hive_thrift_server_ip> is the IP address of the Hive Thrift server, and <port> is the port number. You can refer to the official documentation of the Hive service you use to obtain the connection address information.
Example: thrift:// 101.1xx.xx.xxx:9083
endpoint: The connection address of the external data source. For example, if you use the TOS (Volcano Engine Object Storage Service), you can log in to the TOS console and view the required endpoint via the path Bucket List > Bucket Name > Overview > URL Full Domain. As shown in the figure below, the endpoint is tos-s3-cn-beijing.volces.com. For a list of common endpoints, see Region and URL Full Domain (Endpoint).
ak_id/ak_secret: The key with S3 access privilege. If you use the TOS (Volcano Engine Object Storage Service), see Access Key (密钥) management for how to obtain it.
Replace {your_catalog_name} with your custom catalog name.
Catalog param
type='hive': Set to hive.
metastore_type='lf': Set to lf.
endpoint: The endpoint of the TOS (Volcano Engine Object Storage Service) used by LAS. You can log in to the TOS console and view the required endpoint via the path Bucket List > Bucket Name > Overview > URL Full Domain. As shown in the figure below, the endpoint is tos-s3-cn-beijing.volces.com. For a list of common endpoints, see Region and URL Full Domain (Endpoint).
ak_id/ak_secret: Configure with a TOS key that has access privilege. For information on how to obtain it, see Access Key (密钥) management.
lf_metastore_ak_id/lf_metastore_ak_secret: Configure with an LAS key that has access privilege. For information on how to obtain it, see Access Key (密钥) management.
lf_metastore_catalog: Enter the name of the catalog you want to connect to, which already exists in LAS, so that ByteHouse can locate the correct external data directory. You can log in to the LAS console, click Database > Metadata management in the left navigation bar, and view the catalog name.
lf_metastore_region: Configuration for the physical data center region where the TOS storage service used by LAS is located. For common region names, refer to Region and Access Domain.
lf_metastore_url: Configuration for the metadata storage service address of LAS. Fill in the connection address for the region where LAS is located: thrift://lakeformation.las.{REGION}. ivolces.com:48869. The corresponding addresses for common regions are as follows:
Users can directly access tables in Hive Catalog using the three-part naming convention catalog_name.db_name.table_name, for example:
SELECT * FROM hive_s3.hive_db_name.hive_table_name;
ByteHouse native CnchMergeTree tables can also be accessed with the following SQL. Among them, cnch (abbreviation for cloud-native-clickhouse) is used as the default catalog name for ByteHouse CDW.
SELECT * FROM cnch.cnch_db_name.cnch_db_name;
-- Equivalent to SELECT * FROM cnch_db_name.cnch_db_name;
You can use the following statements to query metadata of databases, tables, and partitions in the Hive Catalog, including database name, storage path, attributes, and so on.
Query metadata of databases in the Hive Catalog
SELECT * FROM catalog_name.database_name.__properties__
Query metadata of tables in the Hive Catalog
SELECT * FROM catalog_name.database_name.table_name$metadata$properties
Query metadata of table partitions in the Hive Catalog
SELECT * FROM {catalog_name.}database_name.table_name$metadata$partitions
Use Hive Catalog through the ByteHouse Cloud Data Warehouse Edition Console #
ByteHouse Cloud Data Warehouse Edition also supports creating and using Hive Catalog through the ByteHouse Cloud Data Warehouse Edition Console. For details, see Manage external catalog.
In addition to accessing Hive data through the Hive Catalog, ByteHouse also supports querying and writing Hive data through external tables. For details, see Hive external table.