环境
虚拟机:VMware 10
Linux版本:CentOS-6.5-x86_64
客户端:Xshell4
FTP:Xftp4
jdk8
hadoop-3.1.1
apache-hive-3.1.1
一、Hive 参数
1、Hive 参数类型
hive当中的参数、变量,都是以命名空间开头;
通过${}方式进行引用,其中system、env下的变量必须以前缀开头;
在Hive CLI查看参数
#显示所有参数 hive>set; #查看单个参数 hive> set hive.cli.print.header; hive.cli.print.header=false
2、Hive参数设置方式
(1)、修改配置文件 ${HIVE_HOME}/conf/hive-site.xml 这会使所有客户端都生效
(2)、启动hive cli时,通过--hiveconf key=value的方式进行设置 这只会在当前客户端生效
例:
[root@PCS102 ~]# hive --hiveconf hive.cli.print.header=true hive> set hive.cli.print.header; hive.cli.print.header=true hive>
(3)、进入cli之后,通过使用set命令设置 这只会在当前客户端生效
hive> set hive.cli.print.header; hive.cli.print.header=false hive> select * from wc; OK hadoop 2 hbase 1 hello 2 name 3 world 1 zookeeper 1 Time taken: 2.289 seconds, Fetched: 6 row(s) hive> set hive.cli.print.header=true; hive> set hive.cli.print.header; hive.cli.print.header=true hive> select * from wc; OK wc.word wc.totalword hadoop 2 hbase 1 hello 2 name 3 world 1 zookeeper 1 Time taken: 2.309 seconds, Fetched: 6 row(s) hive>
(4)使用.hiverc文件设置
当前用户家目录(例:root用户:家目录是/root)下的.hiverc文件
如果没有,可直接创建该文件,将需要设置的参数写到该文件中,hive启动运行时,会加载改文件中的配置。
[root@PCS102 ~]# vi ~/.hiverc set hive.cli.print.header=true :wq
[root@PCS102 ~]# ll -a|grep hive -rw-r--r--. 1 root root 5562 Feb 15 15:01 .hivehistory -rw-r--r--. 1 root root 31 Feb 15 15:03 .hiverc
另外:
.hivehistory 文件记录hive历史操作命令集
#重新登录 可以发现配置生效了 影响当前linux用户登录的客户端
[root@PCS102 ~]# hive hive> set hive.cli.print.header; hive.cli.print.header=true hive>
二、动态分区