1、将hive安装包放到software里
安装包版本:apache-hive-3.1.2-bin.tar.gz
2、将安装包解压在moudule文件夹里
命令:
cd /opt/software/
tar -zxvf 压缩包名 -C /opt/module/
3、修改环境变量
命令:vi /etc/profile
在打开的页面中添加如下内容
4、重启环境配置
命令:source /etc/profile
5、修改你hive环境变量
命令:cd /opt/module/apache-hive-3.1.2-bin/bin/
(1)、配置hive-config.sh文件
命令:vi hive-config.sh
在页面下添加如下内容
export JAVA_HOME=/opt/module/jdk1.8.0_212
export HIVE_HOME=/opt/module/apache-hive-3.1.2-bin
export HADOOP_HOME=/opt/module/hadoop-3.2.0
export HIVE_CONF_DIR=/opt/module/apache-hive-3.1.2-bin/conf
6、拷贝hive文件
命令:
cd /opt/module/apache-hive-3.1.2-bin/conf/
cp hive-default.xml.template hive-site.xml
7、修改hive配置文件,按下图修改
命令:vi hive-site.xml
# 自定义密码
JDBC connect string for a JDBC metastore.
To use SSL to encrypt/authenticate the connection, provide database-specific SSL flag in the connection URL.
For example, jdbc:postgresql://myhost/db?ssl=true for postgres database.
Enforce metastore schema version consistency.
True: Verify that version information stored in is compatible with one from Hive jars. Also disable automatic
schema migration attempt. Users are required to manually migrate schema after Hive upgrade which ensures
proper metastore schema migration. (Default)
False: Warn if the version information stored in metastore doesn't match with one from in Hive jars.
Expects one of [derby, oracle, mysql, mssql, postgres].
Type of database used by the metastore. Information schema & JDBCStorageHandler depend on it.
8、上传mysql驱动包到/opt/module/apache-hive-3.1.2-bin/lib/文件夹下驱动包:mysql-connector-java-8.0.15.zip,解压后从里面获取jar包
9、在数据库中新建一个名为hive的数据库
mysql> create database hive;
10、初始化元数据库
命令:schematool -dbType mysql -initSchema
11、群起
命令:
start-all.sh Hadoop100上
start-yarn.sh Hadoop101上
12、启动hive
命令:hive
13、检测是否启动成功
命令:show databases;
注:出现各类数据库则配置成功



