解压安装
apache-hive-3.1.2-bin.tar.gz
将压缩包上传到 /opt/install/
并解压到/opt/soft/
tar -zxf /opt/install/apache-hive-3.1.2-bin.tar.gz -C /opt/soft/
//修改文件名
mv /opt/soft/apache-hive-3.1.2-bin/ hive312
配置环境变量
vim /etc/profile/
//添加内容如下
#HIVE_HOME
export HIVE_HOME=/opt/soft/hive312
export PATH=$PATH:$HIVE_HOME/bin
添加并配置hive-site.xml
cd /opt/soft/hive312/conf/
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.warehouse.dir</name>
<value>/opt/soft/hive312/warehouse</value>
</property>
<property>
<name>hive.metastore.db.type</name>
<value>mysql</value>
</property>
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://192.168.153.143:3306/hive146?createDatabaseIfNotExist=true</value>
</property>
<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>com.mysql.cj.jdbc.Driver</value>
</property>
<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>root</value>
</property>
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>941006</value>
</property>
<property>
<name>hive.metastore.schema.verification</name>
<value>false</value>
<description>关闭schema验证</description>
</property>
<property>
<name>hive.cli.print.current.db</name>
<value>true</value>
<description>提示当前数据库名</description>
</property>
<property>
<name>hive.cli.print.header</name>
<value>true</value>
<description>查询输出时带列名一起输出</description>
</property>
</configuration>
上传MySQL jar包
把 maven/repository/mysql mysql-connector-java-8.0.29.jar 上传到hive的lib文件夹
删除guava
[root@localhost hive312]# ls ./lib/ | grep guava
[root@localhost hive312]# rm -f ./guava-19.0.jar
[root@localhost hive312]# find /opt/soft/hadoop313/ -name guava*
//把查询到的拷贝到hive312/lib/
[root@localhost hive312]# cp /opt/soft/hadoop313/share/hadoop/common/lib/guava-27.0-jre.jar ./lib/
生效环境变量
[root@localhost hive312]# source /etc/profile
启动
//第一次启动 手动初始化元数据
[root@localhost hive312]# schematool -dbType mysql -initSchema
[root@localhost hive312]# hive