hwi(hive web interface)-hive web页面的搭建

简介

 

hwi(hive web interface)hive命令行接口的一个补充,主要功能包括:

1.shema browsing :获取table的信息,包括serdecolumen namecolumn type

2.detached query execution:在hive命令行界面,用户如果需要执行多个查询,则需要同时打开多个命令行界面。hwi允许用户同时开始多个查询,并且查看执行状态。

3.no local installation:如何人,只要有web browser就可以连接hive,而无需运行安装运行任何客户端。

 

##需要的安装包##

 

 

hive 0.8.1开始,自带hwi,简单配置下即可使用

1.   配置hive

vi ${HIVE_HOME}/conf/hive-site.xml

hive-site.xml在安装hive的时候已经创建好,只需要在后面加上下面的配置即可

<property>

  <name>hive.hwi.listen.host</name>

  <value>0.0.0.0</value>

  <description>This is the host address theHive Web Interface will listen on</description>

</property>

 

<property>

  <name>hive.hwi.listen.port</name>

  <value>9999</value>

  <description>This is the port the Hive WebInterface will listen on</description>

</property>

 

<property>

  <name>hive.hwi.war.file</name>

  <value>lib/hive_hwi.war</value> //这个下面讲

  <description>This is the WAR file with thejsp content for Hive Web Interface</description>

</property>

测试环境下,使用默认值即可,需要hive-site.xml文件,否则报错。

 

2,现在要做的就是添加apache ant的编译工具,不安装则会报错

Problem accessing /hwi/. Reason:

    No Java compiler available

 

##安装ant##

下载安装包wgethttp://apache.mirrors.tds.net/ant/binaries/apache-ant-1.9.4-bin.tar.gz

解压缩:tar -zxvf apache-ant-1.9.4-bin.tar.gz -C/usr/hadoop

##修改环境变量##

vi /etc/profile

export ANT_HOME=/usr/hadoop/ant

export ANT_LIB=/usr/hadoop/ant/lib

PATH添加:/usr/hadoop/ant/bin:

使profile生效:source/etc/profile

执行 ant -v 或者 ant -version 来验证 ant 是否已安装好

##复制jar##

需要把/usr/local/ant/lib下的ant-launcher.jarant.jar这两个jar包和jasper-compiler-5.5.23.jarjasper-runtime-5.5.23.jar这两个jar包(这两个没放,暂时没影响)以及jdklib包下面的tools.jar包拷贝到${ HIVE_HOME } /lib下,并且需要将相应的权限修改为777

# chmod 777 


否则会报错: hive hwi Compile failed; see the compilererror output for details.

同时将目录下原有的 ant-launcher.jar ant.jar 移除

如果出现

cannot access/home/linux/application/hive2.1.0/lib/hive-hwi-*.war: No such file or directory

报错原因:lib下面没有war包,查找各种资料都提示需要从官网下载hive源代码src文件然后打包web文件夹的war文件。

源代码地址:

http://archive.cloudera.com/cdh5/cdh/5/hive-1.1.0-cdh5.4.0-src.tar.gz

##打包war文件##

下载自己hive版本的src文件,解压,进入解压后的hwi/web文件夹

jar -cvf hive-hwi-1.1.0.war *

war包复制到hive安装目录的bin目录下

cp hive-hwi-1.1.0.war ${HIVE_HOME}/lib/

修改hive-site.xml里面对应的配置

 

##启动HWI##

hive --service hwi

 

后台运行hwi
$ nohup hive --config $HIVE_CONF_DIR--service hwi 
 > /dev/null 2> /dev/null & 

然后在浏览器中输入 localhost:9999/hwi,即可打开HWI页面。

猜你喜欢

转载自blog.csdn.net/xiaolong_4_2/article/details/80857642
今日推荐