Hive提供了三種使用者接口:CLI、HWI和用戶端方式。其中最常用的的就是CLI,CLI啟動的時候,會同時啟動一個Hive副本。Client是Hive的用戶端,使用者連接配接至Hive Server。在啟動 Client模式的時候,需要指出Hive Server所在節點,并且在該節點啟動Hive Server。 HWI是通過浏覽器通路Hive。本文介紹Hive Web通路接口。
啟動 hwi :
#hive --service hwi
ls:cannot access/home/hadoopUser/cloud/hive/apache-hive-0.13.1-bin/lib/hive-hwi-*.war: No suchfile or directory
報錯誤的原因是,Hive目前的發行包裡沒有hwi的war封包件,沒有這個war包就不能啟動hwi服務。
1、終端啟動HWI服務
http://apache.fayea.com/hive/ 下載下傳apache-hive-1.2.1-src.tar.gz 源碼包,然後解壓:
# tar -zxvf apache-hive-1.2.1-src.tar.gz
# cd hwi/
# pwd
/usr/local/apache-hive-1.2.1-src/hwi
# jar cvfM0 hive-hwi-1.2.1.war -C web/ .
# ll
total 164
-rw-r--r-- 1 root root 151343 Nov 26 18:29 hive-hwi-1.2.1.war
-rw-rw-r-- 1 root root 4982 Jun 19 2015 pom.xml
drwxrwxr-x 4 root root 4096 Apr 30 2015 src
drwxrwxr-x 5 root root 4096 Nov 26 18:21 web
2、将生成的hive-hwi-1.2.1.war拷貝到/usr/local/hive/lib/
3、在hive-site.xml中添加HWI配置:
<property>
<name>hive.hwi.war.file</name>
<value>lib/hive-hwi-1.2.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>centos1</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>
4、啟動:
#hive --service hwi
#hive --service metastore
注:不管是使用HiveCLI、用戶端還是HWI通路Hive,都需要首先啟動Hive 中繼資料服務,否則無法通路Hive資料庫。
5、通路:

注:啟動時可能會報錯,Unable to find a javaccompiler;com.sun.tools.javac.Main is not on the classpath.Perhaps JAVA_HOMEdoes not point to the JDK.It is currently set to