最具影响力的数字化技术在线社区

168大数据

 找回密码
 立即注册

QQ登录

只需一步,快速开始

1 2 3 4 5
打印 上一主题 下一主题
开启左侧

[Hive] 搭建HWI(HiveWebInterface)步骤总结

[复制链接]
跳转到指定楼层
楼主
发表于 2019-3-31 18:23:58 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

马上注册,结交更多数据大咖,获取更多知识干货,轻松玩转大数据

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
本帖最后由 168主编 于 2019-3-31 18:33 编辑

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

  本博主主要是记录自己的学习内容,有哪些理解不到位的地方还请各位读者提出宝贵意见。
简单查看hwi使用
  在命令行输入:
  
[AppleScript] 纯文本查看 复制代码
hive --service hwi --help

  输出内容如下,给出了HWI的使用方法。
  
[AppleScript] 纯文本查看 复制代码
Usage ANT_LIB=XXXX hive --service hwi

  在命令行输入
[AppleScript] 纯文本查看 复制代码
hive --service hwi 

  报错,报错信息如下:
  
[AppleScript] 纯文本查看 复制代码
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复制到HIVEHOME/bin目录:cphive−hwi−2.1.0.warHIVEHOME/bin目录:cphive−hwi−2.1.0.war{HIVE_HOME}/bin/
  • 根据官网配置hive hwi,步骤如下:
    • cd ${HIVE_HOME}/conf
    • vim hive-site.xml
    • 添加的配置信息如下:


[AppleScript] 纯文本查看 复制代码
<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>${HIVE_HOME}/lib/hive-hwi-<version>.war</value>
  <description>This is the WAR file with the jsp content forHive Web Interface</description>
</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:该步是为了方便在不同版本之间切换测试方便
  • 配置环境变量:
  • [AppleScript] 纯文本查看 复制代码
    vim /etc/profile
     export ANT_HOME=/opt/ant
    export PATH=PATH:PATH:ANT_HOME/bin
  • 使profile生效:source /etc/profile
  • 验证ant是否安装成功:ant -version


尝试启动HWI
  在命令行输入下面的命令,目的是为了启动相关服务。
[color=blue !important]+ View Code


  在浏览器中输入 localhost:9999/hwi。一直刷不出网页,我又把配置文件中hive.hwi.war.file的Value值改为:lib/hive-hwi-2.1.0.war (使用相对路径),然后刷新页面又报错如下:
Unable to find a javac compiler;
com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK

  出错原因: HIVEHOME/lib下没有tools.jar所致。把JAVA安装目录下的tools.jar包复制到HIVEHOME/lib下没有tools.jar所致。把JAVA安装目录下的tools.jar包复制到{HIVE_HOME}/lib,命令如下:
[AppleScript] 纯文本查看 复制代码
cp ${JAVA_HOME}/lib/tools.jar ${HIVE_HOME}/lib

  再次刷新localhost:9999/hwi又如下错误:
   
[AppleScript] 纯文本查看 复制代码
[/backcolor][/align][backcolor=white]The following error occurred while executing this line:
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.
 
Ant could not find the task or a class this task relies upon.
 
This is common and has a number of causes; the usual 
solutions are to read the manual pages then download and
install needed JAR files, or fix the build file: 
- You have misspelt 'componentdef'.
Fix: check your spelling.
- The task needs an external JAR file to execute
and this is not found at the right place in the classpath.
Fix: check the documentation for dependencies.
Fix: declare the task.
- The task is an Ant optional task and the JAR file and/or libraries
implementing the functionality were not found at the time you
yourself built your installation of Ant from the Ant sources.
Fix: Look in the ANT_HOME/lib for the 'ant-' JAR corresponding to the
task and make sure it contains more than merely a META-INF/MANIFEST.MF.
If all it contains is the manifest, then rebuild Ant with the needed
libraries present in ${ant.home}/lib/optional/ , or alternatively,
download a pre-built release version from apache.org
- The build file was written for a later version of Ant
Fix: upgrade to at least the latest release version of Ant
- The task is not an Ant core or optional task 
and needs to be declared using <taskdef>.
- You are attempting to use a task defined using 
<presetdef> or <macrodef> but have spelt wrong or not 
defined it at the point of use
 
Remember that for JAR files to be visible to Ant tasks implemented
in ANT_HOME/lib, the files must be in the same directory or on the
classpath
 
Please neither file bug reports on this problem, nor email the
Ant mailing lists, until all of these causes have been explored,
as this is not an Ant bug.

  根据错误信息,HIVEHOME/lib下的ant.jar版本为1.9.1,但是我装的ant版本为1.9.7,因此该错误是因为版本不一致导致的。因此,需要把HIVEHOME/lib下的ant.jar版本为1.9.1,但是我装的ant版本为1.9.7,因此该错误是因为版本不一致导致的。因此,需要把{ANT_HOME}/lib下的ant.jar包copy到${HIVE_HOME}/lib下,并修改权限为777。
使用的命令如下:
[AppleScript] 纯文本查看 复制代码
cp ${ANT_HOME}/lib/ant.jar  ${HIVE_HOME}/lib/ant-1.9.7.jar
cd ${HIVE_HOME}/lib
chmod 777 ant-1.9.7.jar

 再次启动HWI 
此时可以把原服务关掉,重新启动服务,命令为:hive --service hwi,并在浏览器中输入:localhost:9999/hwi,多刷新几次即可。说明:localhost可能是你的主机名或IP。
HWI的界面如下:
楼主热帖
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 转播转播 分享分享 分享淘帖 赞 踩

168大数据 - 论坛版权1.本主题所有言论和图片纯属网友个人见解,与本站立场无关
2.本站所有主题由网友自行投稿发布。若为首发或独家,该帖子作者与168大数据享有帖子相关版权。
3.其他单位或个人使用、转载或引用本文时必须同时征得该帖子作者和168大数据的同意,并添加本文出处。
4.本站所收集的部分公开资料来源于网络,转载目的在于传递价值及用于交流学习,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。
5.任何通过此网页连接而得到的资讯、产品及服务,本站概不负责,亦不负任何法律责任。
6.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源,若标注有误或遗漏而侵犯到任何版权问题,请尽快告知,本站将及时删除。
7.168大数据管理员和版主有权不事先通知发贴者而删除本文。

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

站长推荐上一条 /1 下一条

关于我们|小黑屋|Archiver|168大数据 ( 京ICP备14035423号|申请友情链接

GMT+8, 2024-5-4 04:17

Powered by BI168大数据社区

© 2012-2014 168大数据

快速回复 返回顶部 返回列表