Hive UI 界面的访问方法

环境:hdp 2.4

hdp 2.4 对应的hive版本是1.2.1如果是hdp 2.4 以及以下的版本,可以参考HDP2.4 及以下各组件版本查看版本信息

安装Hive hwi 的方法:

  1. 下载源代码,根据自己的hive版本下载http://archive.apache.org/dist/hive/apache-hive-1.2.1-src.tar.gz

  2. 解压后将 ./hwi/web/ 目录打包成 hive-hwi-**.war 放入放到hive/lib目录下,打包方式是 执行下面的语句
    jar cvfM0 hive-hwi-1.2.1.war -C web/

  3. 更改配置文件,在hive-site.xml 添加参数,参数可以参考在https://cwiki.apache.org/confluence/display/Hive/HiveWebInterface,或在 hive-default.xml.template 中的拷贝相应的参数(监听主机0.0.0.0表示localhost,监听端口,war文件的目录),参数配置如下:

<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>
<property> 
<name>hive.hwi.war.file</name>
 <value>lib/hive-hwi-1.2.1.war</value> 
<description>This is the WAR file with the jsp content for Hive Web Interface</description>
</property>

配置信息有两种情况:

  • 如果是参考的官网,hive.hwi.war.file 的 value 值<value>${HIVE_HOME}/lib/hive-hwi-<version>.war</value>
    装的hdp中没有配置HIVE_HOME的变量,为了方便直接改为lib/hive-hwi-1.2.1.war
  • 如果拷贝的hive-default.xml.template中的参数,hive.hwi.war.file 的 value 值是
    <value>${env:HWI_WAR_FILE}</value>
    也要把这个value改为lib/hive-hwi-1.2.1.war

如果在你启动的时候,出现下面的错误,那就是你这个参数没有配好
《Hive UI 界面的访问方法》 错误截图

  1. 将jdk/lib/tools.jar 拷贝到hive/lib 目录下
  2. 下载 jasper-compiler-5.5.23.jar 和 jasper-runtime-5.5.23.jar 也拷贝到 hive/lib 目录下
  3. 下载commons-el-5.5.23.jar 拷贝到 hive/lib 目录
  4. 通过ip:9999/hwi 可以访问到hive 的 hwi

《Hive UI 界面的访问方法》 成功啦

在访问UI的过程中,有可能遇到的问题
  1. jasper-compiler-5.5.23.jar 和 jasper-runtime-5.5.23.jar 两个jar包 出现的问题
#  hive --service hwi
WARNING: Use "yarn jar" to launch YARN applications.
16/12/13 11:03:24 INFO hwi.HWIServer: HWI is starting up
16/12/13 11:03:25 INFO mortbay.log: Logging to org.slf4j.impl.Log4jLog(org.mortbay.log) via org.mortbay.log.Slf4jLog
16/12/13 11:03:25 INFO mortbay.log: jetty-6.1.26.hwx
16/12/13 11:03:25 INFO mortbay.log: Extract /usr/hdp/2.4.2.0-258/hive/wi-1.2.1.war to /tmp/Jetty_0_0_0_0_9999_hive.hwi.1.2.1.war__hwi__vrqy3
16/12/13 11:03:25 INFO mortbay.log: NO JSP Support for /hwi, did not fache.jasper.servlet.JspServlet
16/12/13 11:03:25 INFO mortbay.log: Started SocketConnector@0.0.0.0:99
  1. 端口被占用
16/12/13 10:47:00 WARN mortbay.log: failed Jetty23Shims$Server@7e5afaa6: java.ne                               t.BindException: Address already in use
Exception in thread "main" java.net.BindException: Address already in use
        at java.net.PlainSocketImpl.socketBind(Native Method)
        at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:38                               7)
        at java.net.ServerSocket.bind(ServerSocket.java:375)
        at java.net.ServerSocket.<init>(ServerSocket.java:237)
        at org.mortbay.jetty.bio.SocketConnector.newServerSocket(SocketConnector                               .java:80)
        at org.mortbay.jetty.bio.SocketConnector.open(SocketConnector.java:73)
        at org.mortbay.jetty.AbstractConnector.doStart(AbstractConnector.java:28                               3)
        at org.mortbay.jetty.bio.SocketConnector.doStart(SocketConnector.java:14                               7)
        at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:                               50)
        at org.mortbay.jetty.Server.doStart(Server.java:235)
        at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:                               50)
        at org.apache.hadoop.hive.hwi.HWIServer.start(HWIServer.java:102)
        at org.apache.hadoop.hive.hwi.HWIServer.main(HWIServer.java:132)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.                               java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces                               sorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.apache.hadoop.util.RunJar.run(RunJar.java:221)
        at org.apache.hadoop.util.RunJar.main(RunJar.java:136)
  1. commons-el-5.5.23.jar 没有导入 或 版本不对
# hive --service hwi
WARNING: Use "yarn jar" to launch YARN applications.
16/12/13 14:41:59 INFO hwi.HWIServer: HWI is starting up
16/12/13 14:42:00 INFO mortbay.log: Logging to org.slf4j.impl.Log4jLoggerAdapter                                                                             (org.mortbay.log) via org.mortbay.log.Slf4jLog
16/12/13 14:42:00 INFO mortbay.log: jetty-6.1.26.hwx
16/12/13 14:42:00 INFO mortbay.log: Extract /usr/hdp/2.4.2.0-258/hive/lib/hive-h                                                                             wi-1.2.1.war to /tmp/Jetty_0_0_0_0_9999_hive.hwi.1.2.1.war__hwi__vrqy3t/webapp
16/12/13 14:42:00 INFO mortbay.log: Started SocketConnector@0.0.0.0:9999
16/12/13 14:42:12 ERROR mortbay.log: /hwi/
java.lang.NoClassDefFoundError: org/apache/commons/el/ExpressionEvaluatorImpl
        at org.apache.jasper.compiler.JspUtil.<clinit>(JspUtil.java:62)
        at org.apache.jasper.JspCompilationContext.getServletClassName(JspCompil                                                                             ationContext.java:335)
        at org.apache.jasper.JspCompilationContext.getClassFileName(JspCompilati                                                                             onContext.java:485)
        at org.apache.jasper.compiler.Compiler.isOutDated(Compiler.java:380)
        at org.apache.jasper.compiler.Compiler.isOutDated(Compiler.java:333)
        at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext                                                                             .java:561)
        at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper                                                                             .java:299)
        at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:3                                                                             15)
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
        at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511                                                                             )
        at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:4                                                                             01)
        at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.jav                                                                             a:216)
        at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:1                                                                             82)
        at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:7                                                                             67)
        at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450)
        at org.mortbay.jetty.servlet.Dispatcher.forward(Dispatcher.java:327)
        at org.mortbay.jetty.servlet.Dispatcher.forward(Dispatcher.java:126)
        at org.mortbay.jetty.servlet.DefaultServlet.doGet(DefaultServlet.java:50                                                                             3)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
        at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511                                                                             )
        at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:4                                                                             01)
        at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.jav                                                                             a:216)
        at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:1                                                                             82)
        at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:7                                                                             67)
        at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450)
        at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:1                                                                             52)
        at org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.                                                                             java:49)
        at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:1                                                                             52)
        at org.mortbay.jetty.Server.handle(Server.java:326)
        at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:54                                                                             2)
        at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpCo                                                                             nnection.java:928)
        at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:549)
        at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
        at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
        at org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.                                                                             java:228)
        at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.j                                                                             ava:582)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.el.ExpressionEva                                                                             luatorImpl
        at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        ... 38 more
    原文作者:筱筱说
    原文地址: https://www.jianshu.com/p/235fb66ca0f1
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞