hive-hwi安装

1、工作环境 
系统是centos7,jdk是jdk-7u79,hadoop是2.7.1,hive是2.1.1,在已经正常工作的hive环境中,增加web界面,达到通过web界面执行sql查询语句的目的
2、命令行下执行hive 的两种方式
./hive 或 hive --servcie cli
3、执行系统命令
在hive环境,若在执行系统命令,在命令前加上!,例如
hive>!hdfs dfs -ls / ;
列出hdfs的根目录
4、执行sql脚本,例如
hive>source /home/user/user1.sql;
其中 user1.sql的内容是
select id from user limit 1,20;
select name from user limit 1,20;
5、在系统中执行hive 查询语句
[hadoop@user bin]$./hive -e 'show 表名';
6、准备通过web执行hive查询语句前,要注意关闭防火墙,在有root权限的情况下执行命令
#systemctl  status firewalld 查询防火墙工作状态
#systemctl stop firewalld 停止防火墙
#ststemctl disable firewalld
7、运行hive -hwi-*.war包,需要ANT环境,所以需要下载和配置,ANT是一个基于JAVA的编译工具,从功能上类似于make
$wget http://apache.mirrors.tds.net/ant/binaries/apache-ant-1.9.11-bin.tar.gz
$tar -zxvf apache-ant-1.9.11-bin.tar.gz
配置环境变量,在/etc/profile文件中添加
#################################################################
#ANT environment
#export ANT_HOME=/安装目录/apache-ant-1.9.11
#export PATH=$PATH:$ANT_HOME/bin
#################################################################
8、拷贝tools.jar 文件
$cp /jdk安装目录/lib/tools.jar /hive安装目录/lib/
9、制作 hive-hwi-2.1.1.war文件 
下载apache-hive-2.1.1-src.tar.gz并解压
$tar -zxvf apache-hive-2.1.1.tar.gz 
$cd ./apache-hive-2.1.1-src/hwi
$jar cvfM0 hive-hwi-2.1.1.war -C web/ .
将web目录压成 hive-hwi-2.1.1.war文件,参数解释,c创建jar包,v生成详细报告,f指定jar包的文件名,M不产生文件清单,0不对内容进行压缩
将war包拷贝至hive的lib目录下
cp ./apache-hive-2.1.1-src/hwi/hive-hwi-2.1.1.war /hive安装目录/lib/
10、编辑hive-site.xml,检查是否有如下内容
  <property>  
     <name>hive.hwi.war.file</name>  
     <value>lib/hive-hwi-2.1.1.war</value>  
     <description>This sets the path to the HWI war file, relative to ${HIVE_HOME}. </description>  
   </property>  
   <property>  
     <name>hive.hwi.listen.host</name>  
     <value>0.0.0.0</value>  
     <description>This is the host address the Hive Web Interface will listen on</description>  
   </property>  
   <property>  
     <name>hive.hwi.listen.port</name>  
     <value>9999</value>  
     <description>This is the port the Hive Web Interface will listen on</description>  
   </property>    
从配置信息可以看出,缺省端口是9999,war的路径是相对路径 
11、测试 http://ip:9999/hwi

猜你喜欢

转载自blog.csdn.net/lepton126/article/details/80009162
今日推荐