首页 > 代码库 > 启用hive hwi方法

启用hive hwi方法

hive启动hwi:
./hive --service hwi
ls: cannot access /opt/cdh-5.3.6/hive-0.13.1/lib/hive-hwi-*.war: No such file or directory
17/05/12 09:29:47 INFO hwi.HWIServer: HWI is starting up
17/05/12 09:29:48 INFO mortbay.log: Logging to org.slf4j.impl.Log4jLoggerAdapter(org.mortbay.log) via org.mortbay.log.Slf4jLog
17/05/12 09:29:48 INFO mortbay.log: jetty-6.1.26.cloudera.4
17/05/12 09:29:48 INFO mortbay.log: Started SocketConnector@0.0.0.0:9999

从日志可以看到启动hwi报错:cannot access /opt/cdh-5.3.6/hive-0.13.1/lib/hive-hwi-*.war: No such file or directory
这时因为没有hive-hwi-*.war这个包,这里我们需要手工编译这个包:
下载hive源码包:hive-0.13.1-cdh5.3.6-src.tar.gz
解压后进入源码包hwi目录下,执行以下打包命令将hwi目录打成war包:
$sudo jar cvfM0 hive-hwi-0.13.1.war -C web/ .
adding: authorize.jsp(in = 2729) (out= 2729)(stored 0%)
adding: session_create.jsp(in = 2690) (out= 2690)(stored 0%)
adding: show_database.jsp(in = 2346) (out= 2346)(stored 0%)
adding: session_diagnostics.jsp(in = 2489) (out= 2489)(stored 0%)
adding: navbar.jsp(in = 1345) (out= 1345)(stored 0%)
adding: index.jsp(in = 1876) (out= 1876)(stored 0%)
adding: session_history.jsp(in = 3150) (out= 3150)(stored 0%)
adding: session_manage.jsp(in = 6738) (out= 6738)(stored 0%)
adding: session_result.jsp(in = 2488) (out= 2488)(stored 0%)
adding: show_databases.jsp(in = 2096) (out= 2096)(stored 0%)
adding: diagnostics.jsp(in = 2365) (out= 2365)(stored 0%)
adding: css/(in = 0) (out= 0)(stored 0%)
adding: css/bootstrap.min.css(in = 90193) (out= 90193)(stored 0%)
adding: left_navigation.jsp(in = 1553) (out= 1553)(stored 0%)
adding: show_table.jsp(in = 4996) (out= 4996)(stored 0%)
adding: session_remove.jsp(in = 2359) (out= 2359)(stored 0%)
adding: error_page.jsp(in = 1867) (out= 1867)(stored 0%)
adding: session_kill.jsp(in = 2236) (out= 2236)(stored 0%)
adding: WEB-INF/(in = 0) (out= 0)(stored 0%)
adding: WEB-INF/web.xml(in = 1438) (out= 1438)(stored 0%)
adding: view_file.jsp(in = 2653) (out= 2653)(stored 0%)
adding: session_list.jsp(in = 2298) (out= 2298)(stored 0%)
adding: img/(in = 0) (out= 0)(stored 0%)
adding: img/glyphicons-halflings.png(in = 4352) (out= 4352)(stored 0%)
adding: img/glyphicons-halflings-white.png(in = 4352) (out= 4352)(stored 0%)
将打包后的war包cp到hive/lib目录下:
cp hive-hwi-0.13.1.war /opt/cdh-5.3.6/hive-0.13.1/lib/

在hive-site.xml文件中配置hive-hwi包路径:

    <property>
         <name>hive.hwi.war.file</name>
         <value>lib/hive-hwi-0.13.1.war</value>
     </property>
    
启动hive hwi,通过web登录http://host:port/hwi,报错如下:

com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK.
It is currently set to "/opt/java/jdk1.7.0_67/jre"
    
解决办法:

cp /opt/java/jdk1.7.0_67/lib/tools.jar /opt/cdh-5.3.6/hive-0.13.1/lib/

然后再次登录成功。

 

hive hwi相关参数:

 

./hive -e "set" |grep hive.hwi.listen
hive.hwi.listen.host=0.0.0.0
hive.hwi.listen.port=9999

hive.hwi.war.file=lib/hive-hwi-0.13.1.war

启用hive hwi方法