- Metastore like your kudu file system or Hive metastore
Usage notes
You can only use Kudu catalogs to query data. You cannot use Kudu catalogs to drop, delete, or insert data into your Kudu cluster.Integration preparations
Before you create a Kudu catalog, make sure your cluster can integrate with the storage system and metastore of your Kudu cluster.NOTE If an error indicating an unknown host is returned when you send a query, you must add the mapping between the host names and IP addresses of your KUDU cluster nodes to the /etc/hosts path.
Kerberos authentication
If Kerberos authentication is enabled for your KUDU cluster or Hive metastore, configure your cluster as follows:- Run the
kinit -kt keytab_path principalcommand on each FE and each BE to obtain Ticket Granting Ticket (TGT) from Key Distribution Center (KDC). To run this command, you must have the permissions to access your KUDU cluster and Hive metastore. Note that accessing KDC with this command is time-sensitive. Therefore, you need to use cron to run this command periodically. - Add
JAVA_OPTS="-Djava.security.krb5.conf=/etc/krb5.conf"to the BE_HOME/conf/be.conf file of each BE. In this example,/etc/krb5.confis the save path of the krb5.conf file. You can modify the path based on your needs.
Create a Kudu catalog
Syntax
Parameters
catalog_name
The name of the Kudu catalog. The naming conventions are as follows:- The name can contain letters, digits (0-9), and underscores (_). It must start with a letter.
- The name is case-sensitive and cannot exceed 1023 characters in length.
comment
The description of the Kudu catalog. This parameter is optional.type
The type of your data source. Set the value tokudu.
CatalogParams
A set of parameters about how the database accesses the metadata of your Kudu cluster. The following table describes the parameter you need to configure inCatalogParams.
NOTE
If you use Hive metastore, you must add the mapping between the host names and IP addresses of your Hive metastore nodes to the /etc/hosts path before you query Kudu data. Otherwise, the database may fail to access your Hive metastore when you start a query.
Examples
-
The following examples create a Kudu catalog named
kudu_catalogwhose metastore typekudu.catalog.typeis set tokuduto query data from your Kudu cluster. -
The following examples create a Kudu catalog named
kudu_catalogwhose metastore typekudu.catalog.typeis set tohiveto query data from your Kudu cluster.
View Kudu catalogs
You can use SHOW CATALOGS to query all catalogs in the current cluster:kudu_catalog:
Drop a Kudu catalog
You can use DROP CATALOG to drop an external catalog. The following example drops a Kudu catalog namedkudu_catalog:
View the schema of a Kudu table
You can use one of the following syntaxes to view the schema of a Kudu table:-
View schema
-
View schema and location from the CREATE statement
Query a Kudu table
-
Use SHOW DATABASES to view the databases in your Kudu cluster:
-
Use SET CATALOG to switch to the destination catalog in the current session:
Then, use USE to specify the active database in the current session:Or, you can use USE to directly specify the active database in the destination catalog:
-
Use SELECT to query the destination table in the specified database:
Load data from Kudu
Suppose you have an OLAP table namedolap_tbl, you can transform and load data like below: