Hive 安装

Hive 官网地址:https://hive.apache.org/

文档查看地址:https://cwiki.apache.org/confluence/display/Hive/GettingStarted

下载地址:https://hive.apache.org/downloads.html & https://archive.apache.org/dist/hive/

Hadoop 2.x 版本要下载 Hive 2.x 或 1.x 的版本

Hadoop 3.x 版本要下载 Hive 3.x 的版本

 

一、下载

curl -o /opt/apache-hive-2.3.6-bin.tar.gz http://us.mirrors.quenda.co/apache/hive/hive-2.3.6/apache-hive-2.3.6-bin.tar.gz

tar -zxf /opt/apache-hive-2.3.6-bin.tar.gz -C /opt/

 

二、配置

hive-env.sh

复制代码
cd /opt/apache-hive-2.3.6-bin/conf/
cp hive-env.sh.template hive-env.sh
vim hive-env.sh


# Set HADOOP_HOME to point to a specific hadoop install directory
# HADOOP_HOME=${bin}/../../hadoop
HADOOP_HOME=/opt/hadoop-2.9.2

# Hive Configuration Directory can be controlled by:
# export HIVE_CONF_DIR=
HIVE_CONF_DIR=/opt/apache-hive-2.3.6-bin/conf
复制代码

hive-site.xml

cd /opt/apache-hive-2.3.6-bin/conf/
# 可配置项在 hive-default.xml.template 中查看
vim hive-site.xml

添加下面几项

复制代码
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
  <property>
    <name>hive.metastore.schema.verification</name>
    <value>false</value>
  </property>
  <property>
    <name>hive.server2.webui.host</name>
    <value>0.0.0.0</value>
  </property>
  <property>
    <name>hive.server2.webui.port</name>
    <value>10002</value>
  </property>
</configuration>
复制代码

环境变量

vim /etc/profile

export HIVE_HOME=/opt/apache-hive-2.3.6-bin
export PATH=$PATH:$HIVE_HOME/bin

source /etc/profile

 

三、启动

必须先启动 hdfs 和 yarn

start-dfs.sh
start-yarn.sh

初始化

cd /opt/apache-hive-2.3.6-bin/

# 使用 Hive 2.x 之前的版本,不做初始化元数据库也可以
# 使用 Hive 2.x 版本的,必须手动初始化元数据库
# 这里使用自带的 derby,也可以换成 MySQL
# 执行后会在当前目录下生成 derby.log(日志)和 metastore_db(元数据库)
schematool -dbType derby -initSchema

启动 Hive

复制代码
cd /opt/apache-hive-2.3.6-bin/bin/

# hive --service metastore

# 启动 Hive
# 或 hive --service cli
hive
show databases;
quit;
复制代码

启动 hiveserver2

cd /opt/apache-hive-2.3.6-bin/bin/

# 启动 Hive 自带的 WebUI,默认端口为 10002。
# hive --service hiveserver2
hiveserver2


https://cwiki.apache.org/confluence/display/Hive/GettingStarted#GettingStarted-InstallingHivefromaStableRelease

https://cwiki.apache.org/confluence/display/Hive/GettingStarted#GettingStarted-RunningHive

posted @   江湖小小白  阅读(381)  评论(0编辑  收藏  举报
编辑推荐:
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
· 一个奇形怪状的面试题:Bean中的CHM要不要加volatile?
· [.NET]调用本地 Deepseek 模型
· 一个费力不讨好的项目,让我损失了近一半的绩效!
阅读排行:
· 微软正式发布.NET 10 Preview 1:开启下一代开发框架新篇章
· 没有源码,如何修改代码逻辑?
· PowerShell开发游戏 · 打蜜蜂
· 在鹅厂做java开发是什么体验
· WPF到Web的无缝过渡:英雄联盟客户端的OpenSilver迁移实战
点击右上角即可分享
微信分享提示