第一篇已经介绍hive访问的三种方式:CLI,JDBC/ODBC和WebUI,这篇重点描述如何通过WebUI的方式访问Hive?虽然这种做法几乎不用,但还是在此做个笔记。
1、解压hive源代码到某个目录,并进入到解压后的一个子文件夹hwi(Hive web interface)
tar -zxvf apache-hive-0.14.0-src.tar.gz
cd apache-hive-0.14.0-src/hwi
2、将hwi下面的web/打成一个war包
jar cvfM0 hive-hwi-0.14.0.war -C web/ .
3、将2中的war拷贝到$HIVE_HOME/lib目录下
cp hive-hwi-0.14.0.war /usr/local/hive-0.14.0/lib/
4、拷贝$JAVA_HOME/lib/tools.jar到$HIVE_HOME/lib目录下
cp /usr/local/jdk1.7.0_55/lib/tools.jar /usr/local/hive-0.14.0/lib/
5、修改hive的配置文件hive-site.xml
<property>
<name>hive.hwi.listen.host</name>
<value>机器名或IP</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>
<property>
<name>hive.hwi.war.file</name>
<value>lib/hive-hwi-0.14.0.war</value>
<description>This sets the path to the HWI war file, relative to ${HIVE_HOME}. </description>
</property>
6、启动hwi
./hive --service hwi &
查询9999端口进程:netstat -tunlp | grep 9999
7、浏览器访问hwi
http://<IP或机器名>:9999/hwi/