📜  HCatalog-CLI

📅  最后修改于: 2020-11-30 04:23:53             🧑  作者: Mango


可以从命令$ HIVE_HOME / HCatalog / bin / hcat调用HCatalog命令行界面(CLI),其中$ HIVE_HOME是Hive的主目录。 hcat是用于初始化HCatalog服务器的命令。

使用以下命令初始化HCatalog命令行。

cd $HCAT_HOME/bin
./hcat

如果安装正确完成,那么您将获得以下输出-

SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
usage: hcat { -e "" | -f "" } 
   [ -g "" ] [ -p "" ] 
   [ -D" = " ]
    
-D     use hadoop value for given property
-e                 hcat command given from command line
-f                 hcat commands in file
-g                group for the db/table specified in CREATE statement
-h,--help                Print help information
-p                permissions for the db/table specified in CREATE statement

HCatalog CLI支持以下命令行选项-

Sr.No Option Example & Description
1 -g

hcat -g mygroup …

The table to be created must have the group “mygroup”.

2 -p

hcat -p rwxr-xr-x …

The table to be created must have read, write, and execute permissions.

3 -f

hcat -f myscript.HCatalog …

myscript.HCatalog is a script file containing DDL commands to execute.

4 -e

hcat -e ‘create table mytable(a int);’ …

Treat the following string as a DDL command and execute it.

5 -D

hcat -Dkey = value …

Passes the key-value pair to HCatalog as a Java system property.

6

hcat

Prints a usage message.

注意-

  • -g-p选项不是必需的。

  • 一次可以提供-e-f选项,但不能同时提供。

  • 期权的顺序无关紧要。您可以按任何顺序指定选项。

Sr.No DDL Command & Description
1

CREATE TABLE

Create a table using HCatalog. If you create a table with a CLUSTERED BY clause, you will not be able to write to it with Pig or MapReduce.

2

ALTER TABLE

Supported except for the REBUILD and CONCATENATE options. Its behavior remains same as in Hive.

3

DROP TABLE

Supported. Behavior the same as Hive (Drop the complete table and structure).

4

CREATE/ALTER/DROP VIEW

Supported. Behavior same as Hive.

Note − Pig and MapReduce cannot read from or write to views.

5

SHOW TABLES

Display a list of tables.

6

SHOW PARTITIONS

Display a list of partitions.

7

Create/Drop Index

CREATE and DROP FUNCTION operations are supported, but the created functions must still be registered in Pig and placed in CLASSPATH for MapReduce.

8

DESCRIBE

Supported. Behavior same as Hive. Describe the structure.

后续章节中将说明上表中的某些命令。