一、Hive的常用内部命令
- 1、有好几种方式可以与Hive进行交互。此处主要是命令行界面(CLI)。
- 2、$HIVE_HOME/bin目录下包含了可以执行各种各样Hive服务的可执行文件,包括hive命令行界面(CLI是使用Hive的最常用方式)。
[admin@master ~]$ cd apache-hive-1.2.2-bin/bin
[admin@master bin]$ ls
beeline ext hive hive-config.sh hiveserver2 metatool schematool
- 3、输入命令hive --help可以查看到hive命令的一个简明说明的选项列表。
[admin@master ~]$ hive --help
Usage ./hive <parameters> --service serviceName <service parameters>
Service List: beeline cli help hiveburninclient hiveserver2 hiveserver hwi jar lineage metastore metatool orcfiledump rcfilecat schemaTool version
Parameters parsed:
--auxpath : Auxillary jars
--config : Hive configuration directory
--service : Starts specific service/component. cli is default
Parameters used:
HADOOP_HOME or HADOOP_PREFIX : Hadoop install directory
HIVE_OPT : Hive options
For help on a particular service:
./hive --service serviceName --help
Debug help: ./hive --debug --help
[admin@master ~]$
(1)–auxpath选项允许用户指定一个以冒号分割的“附属的”Java包(JAR),这些文件中包含有用户可能需要的自定义扩展等。用户个性化的需求。
(2)–config文件目录这个命令允许用户覆盖$HIVE_HOME/conf中默认的属性配置,而指向一个新的配置文件目录。但一般不使用这个命令,而是在如下目录中新建hive-site.xml配置属性。
[admin@master ~]$ cd apache-hive-1.2.2-bin/conf
[admin@master conf]$ ls
beeline-log4j.properties.template hive-env.sh.template hive-log4j.properties.template ivysettings.xml
hive-default.xml.template hive-exec-log4j.properties.template hive-site.xml
- 4、执行shell命令
(1)用户不要退出hive CLI就可以执行简单的bash shell命令,需要在命令加上感叹号“!”,并且以“;”结尾。
hive> !pwd;
/home/admin
hive> !ls -ll;
总用量 315228
-rw-rw-r--. 1 admin admin 240 12月 7 06:46 _
drwxrwxr-x. 8 admin admin 159 3月 13 21:11 apache-hive-1.2.2-bin
-rw-rw-r--. 1 admin admin 90859180 3月 13 21:09 apache-hive-1.2