系统相关
首页 > 系统相关> > 01 在CentOS7中安装Hive

01 在CentOS7中安装Hive

作者:互联网

hive是能够使mapreduce过程简化的数据仓库,提供了众多的常用算子。hive的安装部署有三种:默认[使用自带deby数据库]、本地[使用mysql数据库]和远程[metastore和mysql不在同一个机子]。本文将阐述hive在CentOS7中的默认安装。

1 系统、软件以及前提约束

2 操作

tar -xvf apache-hive-0.14.0-bin.tar.gz
# 配置环境变量,修改~/.bashrc,在其中加入以下内容【请读者根据实际情况修改路径】
export JAVA_HOME=/root/jdk1.8.0_152
export HIVE_HOME=/root/apache-hive-0.14.0-bin
export PATH=$HIVE_HOME/bin:$HIVE_HOME/conf:$JAVA_HOME/bin:$PATH
# 保存退出,使生效
source ~/.bashrc
# 进入hive配置目录
cd /root/apache-hive-0.14.0-bin/conf
# 由模板拷贝一份hive-site.xml
cp hive-default.xml.template hive-site.xml  
# 修改hive-site.xml,加入以下内容,保存退出
<property>
   <name>system:java.io.tmpdir</name>
     <value>/root/apache-hive-0.14.0-bin/tmpdir</value>
     </property>
<property>
     <name>system:user.name</name>
     <value>hive</value>
   </property>
# 进入hadoop的bin目录
cd /root/hadoop-2.5.2/bin
# 创建/user/hive/warehouse
./hdfs dfs -mkdir -p /user/hive/warehouse  
# 赋予/user/hive/warehouse权限
./hdfs dfs -chmod 777 /user/hive/warehouse  
# 创建/tmp/hive 
./hdfs dfs -mkdir -p /tmp/hive 
# 赋予/tmp/hive 权限
./hdfs dfs -chmod 777 /tmp/hive 
# 进入hive的conf目录
cd /root/apache-hive-0.14.0-bin/conf   
# 拷贝hive-env.sh
cp hive-env.sh.template hive-env.sh
# 修改以下键值对
# Set HADOOP_HOME to point to a specific hadoop install directory
HADOOP_HOME=/root/hadoop-2.5.2

# Hive Configuration Directory can be controlled by:
export HIVE_CONF_DIR=/root/apache-hive-0.14.0-bin/conf

# Folder containing extra ibraries required for hive compilation/execution can be controlled by:
export HIVE_AUX_JARS_PATH=/root/apache-hive-0.14.0-bin/lib

3 测试

# 进入hive的bin目录
cd /root/apache-hive-0.14.0-bin/bin
# 启动hive
./hive
# 出现以下内容,则启动成功,具体内容有些许差别,但大体一致
[root@localhost bin]# ./hive
Logging initialized using configuration in jar:file:/root/apache-hive-0.14.0-bin/lib/hive-common-0.14.0.jar!/hive-log4j.properties
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/root/hadoop-2.5.2/share/hadoop/common/lib/slf4j-log4j12-1.7.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/root/apache-hive-0.14.0-bin/lib/hive-jdbc-0.14.0-standalone.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
hive> 

以上,就是在CentOS7中安装hive默认方式的过程。

标签:bin,01,hive,CentOS7,0.14,Hive,apache,HOME,root
来源: https://www.cnblogs.com/alichengxuyuan/p/12576893.html