众所周知,Hive有三种使用方式:CLI、HWI浏览器、Thrift客户端。安装配置完Hive后无需进行额外操作即可使用CLI。但是HWI则需要单独搭建。本文主要记录我自己搭建HWI的过程。

  说明:本文主要介绍HWI的安装,后续会完成下面两篇博文:

  • HWI的介绍
  • HWI的使用

  本博主主要是记录自己的学习内容,有哪些理解不到位的地方还请各位读者提出宝贵意见。

简单查看hwi使用

  在命令行输入:

  1. hive --service hwi --help

  输出内容如下,给出了HWI的使用方法。

  1. Usage ANT_LIB=XXXX hive --service hwi

  在命令行输入

  1. hive --service hwi

  报错,报错信息如下:

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

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

搭建HWI

打包war文件

  • 下载src文件地址:http://apache.fayea.com/hive/hive-2.1.0/   PS:选择自己的版本
  • 解压src文件:tar -xzf  apache-hive-2.1.0-src.tar.gz
  • 进入web文件夹:cd apache-hive-2.1.0-src/hwi/web
  • 打包war文件:jar  -xcf hive-hwi-2.1.0.war *
  • 把war复制到${HIVE_HOME}/bin目录:cp hive-hwi-2.1.0.war ${HIVE_HOME}/bin/
  • 根据官网配置hive hwi,步骤如下:
    • cd ${HIVE_HOME}/conf
    • vim hive-site.xml
    • 添加的配置信息如下:
  1. <property>
  2. <name>hive.hwi.listen.host</name>
  3. <value>0.0.0.0</value>
  4. <description>This is the host address the Hive Web Interface will listen on</description>
  5. </property>
  6. <property>
  7. <name>hive.hwi.listen.port</name>
  8. <value>9999</value>
  9. <description>This is the port the Hive Web Interface will listen on</description>
  10. </property>
  11. <property>
  12. <name>hive.hwi.war.file</name>
  13. <value>${HIVE_HOME}/lib/hive-hwi-<version>.war</value>
  14. <description>This is the WAR file with the jsp content forHive Web Interface</description>
  15. </property>

安装ANT

HWI需要用Apache的ANT来编译,因此需要安装ANT。

Apache Ant is a Java library and command-line tool that help building software.

ANT的安装及配置步骤

  • 下载ANT下载地址:https://www.apache.org/dist/ant/binaries/
  • 解压:unzip apache-ant-1.9.7-bin.zip
  • 重命名:mv apache-ant-1.9.7 ant1.9.7   PS:该步骤可以省略,重命名只是为了使用简短方便
  • 建立软连接:ln -s ant1.9.7 ant    PS:该步是为了方便在不同版本之间切换测试方便
  • 配置环境变量:vim /etc/profile

    export ANT_HOME=/opt/ant
    export PATH=$PATH:$ANT_HOME/bin

  • 使profile生效:source /etc/profile
  • 验证ant是否安装成功:ant -version

尝试启动HWI

  在命令行输入下面的命令,目的是为了启动相关服务。

  1. hive --service hwi

  在浏览器中输入 localhost:9999/hwi。一直刷不出网页,我又把配置文件中hive.hwi.war.file的Value值改为:lib/hive-hwi-2.1.0.war (使用相对路径),然后刷新页面又报错如下:

  1. Unable to find a javac compiler;
  2. com.sun.tools.javac.Main is not on the classpath.
  3. Perhaps JAVA_HOME does not point to the JDK

  出错原因:${HIVE_HOME}/lib下没有tools.jar所致。把JAVA安装目录下的tools.jar包复制到${HIVE_HOME}/lib,命令如下:

  1. cp ${JAVA_HOME}/lib/tools.jar ${HIVE_HOME}/lib

  再次刷新localhost:9999/hwi又如下错误:

  1. The following error occurred while executing this line:
  2. jar:file:/home/linux/application/hive2.1.0/lib/ant-1.9.1.jar!/org/apache/tools/ant/antlib.xml:37: Could not create task or type of type: componentdef.
  3.  
  4. Ant could not find the task or a class this task relies upon.
  5.  
  6. This is common and has a number of causes; the usual
  7. solutions are to read the manual pages then download and
  8. install needed JAR files, or fix the build file:
  9. - You have misspelt 'componentdef'.
  10. Fix: check your spelling.
  11. - The task needs an external JAR file to execute
  12. and this is not found at the right place in the classpath.
  13. Fix: check the documentation for dependencies.
  14. Fix: declare the task.
  15. - The task is an Ant optional task and the JAR file and/or libraries
  16. implementing the functionality were not found at the time you
  17. yourself built your installation of Ant from the Ant sources.
  18. Fix: Look in the ANT_HOME/lib for the 'ant-' JAR corresponding to the
  19. task and make sure it contains more than merely a META-INF/MANIFEST.MF.
  20. If all it contains is the manifest, then rebuild Ant with the needed
  21. libraries present in ${ant.home}/lib/optional/ , or alternatively,
  22. download a pre-built release version from apache.org
  23. - The build file was written for a later version of Ant
  24. Fix: upgrade to at least the latest release version of Ant
  25. - The task is not an Ant core or optional task
  26. and needs to be declared using <taskdef>.
  27. - You are attempting to use a task defined using
  28. <presetdef> or <macrodef> but have spelt wrong or not
  29. defined it at the point of use
  30.  
  31. Remember that for JAR files to be visible to Ant tasks implemented
  32. in ANT_HOME/lib, the files must be in the same directory or on the
  33. classpath
  34.  
  35. Please neither file bug reports on this problem, nor email the
  36. Ant mailing lists, until all of these causes have been explored,
  37. as this is not an Ant bug.

  根据错误信息,${HIVE_HOME}/lib下的ant.jar版本为1.9.1,但是我装的ant版本为1.9.7,因此该错误是因为版本不一致导致的。因此,需要把${ANT_HOME}/lib下的ant.jar包copy到${HIVE_HOME}/lib下,并修改权限为777。使用的命令如下:

  1. cp ${ANT_HOME}/lib/ant.jar ${HIVE_HOME}/lib/ant-1.9.7.jar
  2. cd ${HIVE_HOME}/lib
  3. chmod 777 ant-1.9.7.jar

 再次启动HWI 

此时可以把原服务关掉,重新启动服务,命令为:hive --service hwi,并在浏览器中输入:localhost:9999/hwi,多刷新几次即可。说明:localhost可能是你的主机名或IP。

HWI的界面如下:

参考官网:https://cwiki.apache.org/confluence/display/Hive/HiveWebInterface

搭建HWI(HiveWebInterface)步骤总结的更多相关文章

  1. ssh框架搭建的基本步骤(以及各部分作用)

    ssh框架搭建的基本步骤(以及各部分作用)     一.首先,明确spring,struts,hibernate在环境中各自的作用.   struts: 用来响应用户的action,对应到相应的类进行 ...

  2. 搭建ssm的步骤

    搭建SSM的步骤 ----------------------------- 1.创建web工程 2.把SSM做需要的所有jar导入工程中 3.web.xml 1.Springmvc的前端控制器,如果 ...

  3. 测试那些事儿—Linux搭建环境基础步骤

    Linux搭建环境基础步骤 准备工具:SecureCRT工具(Linux工具,连接服务器)FTP传输工具(上传文件到服务器)MySQL连接工具 安装包(以下文件均为压缩包rpm格式和tar.gz):J ...

  4. [炼丹术]使用Pytorch搭建模型的步骤及教程

    使用Pytorch搭建模型的步骤及教程 我们知道,模型有一个特定的生命周期,了解这个为数据集建模和理解 PyTorch API 提供了指导方向.我们可以根据生命周期的每一个步骤进行设计和优化,同时更加 ...

  5. 搭建SSH详细步骤及相关说明

    因为手里已有相关jar,为方便我搭建的是:Struts2.0+Hibernate3.3+Spring3.0,数据库:MySQL 如果想搭建最新的,在官网上下载最新jar即可. 这里会对比MyEclip ...

  6. CentOS服务器上搭建Gitlab安装步骤、中文汉化详细步骤、日常管理以及异常故障排查

    一, 服务器快速搭建gitlab方法 可以参考gitlab中文社区 的教程centos7安装gitlab:https://www.gitlab.cc/downloads/#centos7centos6 ...

  7. mybatis环境搭建和开发步骤

    环境搭建 第一步:导入jar包 第二步:导入核心配置文件(mybatis-config.xml) <?xml version="1.0" encoding="UTF ...

  8. vue框架搭建的详细步骤(一)

    在这里我们先快速的搭建一个vue的脚手架: (1).在安装vue的环境之前,安装NodeJS环境是必须的.可以使用node -v指令检查,需要保证安装了4.0版本以上的nodeJS环境. 没有安装的话 ...

  9. 基于微软hyper-v虚拟化服务器搭建方法和步骤整理

    基于Microsoft基础设施私有云计算搭建 摘要:私有云是指组织机构建设的专供自己使用的云平台,它所提供的服务不是供他人使用,而是供自己的内部人员或分支机构使用,不同于公有云,私有云部署在企业内部网 ...

随机推荐

  1. linux术语解析(持续更新)

    1.linux内核有个版本,分别是 longterm: 提供长期支持的内核版本 stable: 稳定版本 Beta 测试版

  2. 如何修改Linux系统下的PATH(如何添加自己的路径到PATH)

    修改Linux的PATH方法有三(添加用户的路径到PATH): 方法一: 直接在命令行中输入:#PATH=$PATH:/etc/apache/bin.这种方法只对当前会话有效,也就是说每当登出或注销系 ...

  3. Landsat元数据批量下载工具

    目录 前言 landsat数据情况简介 下载元数据 总结 一.前言        最近由于工作需要,需要下载部分landsat数据的元数据,老板大手一挥,给了十几年的landsat的path.row以 ...

  4. java 安卓开发之文件的读与写

    java文件的读与写,代码: String file="user.txt"; private void writeFileData(String str1, String str2 ...

  5. Python正则表达式+自创口诀

    重新学习了Python正则表达式,看了一些很好的学习博客,向大家推荐这个. 感谢作者@AstralWind 博客地址:http://www.cnblogs.com/huxi/archive/2010/ ...

  6. 2.2.5 NIO.2 Path 和 Java 已有的 File 类

    NIO与IO交互 toPath() File -- Path toFile() Path -- File Demo: import java.io.File; import java.nio.file ...

  7. jQuery放大镜插件jqzoom使用

    源码下载,使用指导地址:http://www.mind-projects.it/projects/jqzoom/ 使用教程: 1.导入库文件 <script src="../js/jq ...

  8. localstorage || globalStorage || userData

    globalStorage 这个也是html5中提出来,在浏览器关闭以后,使用globalStorage存储的信息仍能够保留下来,并且存储容量比IE的userdata大得多,一个域下面是5120k.和 ...

  9. 【行为型】Observer模式

    观察者模式意图解决一对多的依赖关系情形中,当被依赖对象的状态发生改变时,所有依赖于它的对象都得到通知并被自动更新的问题.举个很简单的例子说,假如一个游戏中的角色的某个属性状态发生了变化,此处不妨假设为 ...

  10. UVa 673 Parentheses Balance(栈的使用)

     栈 Time Limit:3000MS     Memory Limit:0KB     64bit IO Format:%lld & %llu   Description You are ...