Hive之安装
Hive安装
一、安装Hadoop
# hive依赖Hadoop,所以需要安装Hadoop
# Hadoop安装手册详见链接:https://www.cnblogs.com/botaoli/p/17565965.html
# 执行程序运行在yarn上面,需要启动start-yarn.sh
Hadoop安装手册:https://www.cnblogs.com/botaoli/p/17565965.html
二、安装MySQL
# hive数据存储到MySQL里面,所有需要安装MySQL
MySQL安装手册:https://www.cnblogs.com/botaoli/p/13881479.html
三、安装hive
3.1 通过scp导入hive包
# 上传 hive 安装包
apache-hive-2.1.1-bin.tar.gz
3.2 安装hive
cd /opt/install_bak
# 解压hive
tar -zxvf apache-hive-2.1.1-bin.tar.gz -C ../
# 修改目录名称
cd /opt/
mv apache-hive-2.1.1-bin hive-2.1.1
# 配置环境变量
export JAVA_HOME=/opt/jdk1.8.0_281
export JAVA_BIN=/opt/jdk1.8.0_281/bin
export PATH=$PATH:$JAVA_HOME/bin
export HADOOP_HOME=/opt/hadoop-2.7.2
export HIVE_HOME=/opt/hive-2.1.1
export CLASSPATH=.:$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$HADOOP_HOME/bin:$HADOOP_HOME/sbin:$HIVE_HOME/bin:
export JAVA_HOME JAVA_BIN PATH CLASSPATH
# 刷新环境变量
source /etc/profile
3.3 修改配置文件
hive-site.xml
cp hive-default.xml.template hive-site.xml
vim hive-site.xml
<configuration>
<!--数据仓库位置-->
<property>
<name>hive.metastore.warehouse.dir</name>
<value>/user/hive/warehouse</value>
<description>location of default database for the warehouse</description>
</property>
<!--表头信息显示-->
<property>
<name>hive.cli.print.header</name>
<value>true</value>
</property>
<property>
<name>hive.cli.print.current.db</name>
<value>true</value>
</property>
<!--数据保存在mysql中-->
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://master01:3306/hive?characterEncoding=UTF-8</value>
</property>
<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>com.mysql.jdbc.Driver</value>
</property>
<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>root</value>
</property>
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>root</value>
</property>
</configuration>
hive-log4j2.properties
cp hive-log4j2.properties.template hive-log4j2.properties
vim hive-log4j2.properties
# 修改日志信息配置
20行:hive.log.dir=/opt/hive-2.1.1/logs
3.4 通过ftp工具将mysql驱动导入到hive/lib/下
cp /opt/install_bak/mysql-connector-java-5.1.34-bin.jar /opt/hive-2.1.1/lib/
3.5 将hive和hadoop的jline包保持一致
# 将hive的jline 包cp到hadoop一份
hive:/opt/hive-2.1.1/lib
hadoop:/opt/hadoop-2.7.2/share/hadoop/yarn/lib
cp jline-2.12.jar /opt/hadoop-2.7.2/share/hadoop/yarn/lib
做自己的太阳,成为别人的光!