Table of contents
1. Download the hive installation package
2. Unzip hive and configure environment variables
Three configuration files for configuring hive
Seven use datagrip to connect to hive
1. Download the hive installation package
Baidu network disk resources are as follows:
Link: https://pan.baidu.com/s/18jF-Qri0hc52_rtL61O0YQ?pwd=dvju Extraction code: dvju
After downloading, upload it to the /opt/install folder of the linux virtual machine
2. Unzip hive and configure environment variables
Go to the install directory (the install folder is a custom folder we use to store the installation package)
cd /opt/install
decompress hive
tar -zxf ./apache-hive-3.1.2-bin.tar.gz -C /opt/soft/
rename the folder
mv ./apache-hive-3.1.2-bin/ hive312
Configure environment variables
vim /etc/profile
#hive
export HIVE_HOME=/opt/soft/hive312
export PATH=$HIVE_HOME/bin:$PATH
Three configuration files for configuring hive
The following commands are run under the conf folder
cd /opt/soft/hive312/conf
Change hive-default.xml.template to hive-default.xml
mv hive-default.xml.template hive-default.xml
Configure hive-site.xml (create a new file)
vim ./hive-site.xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
<!-- hdfs仓库路径 -->
<property>
<name>hive.metastore.warehouse.dir</name>
<value>/hive312/warehouse</value>
</property>
<!-- metastore元数据库类型 -->
<property>
<name>hive.metastore.db.type</name>
<value>mysql</value>
</property>
<!-- 连接mysql字符串 -->
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://192.168.78.141:3306/hive131?createDatabaseIfNotExist=true</value>
</property>
<!-- mysql连接驱动 -->
<property>
<name>javax.jdo.option.ConnectionDriverName</name>
<value>com.mysql.cj.jdbc.Driver</value>
</property>
<!-- mysql连接帐号 -->
<property>
<name>javax.jdo.option.ConnectionUserName</name>
<value>root</value>
</property>
<!-- mysql连接密码 -->
<property>
<name>javax.jdo.option.ConnectionPassword</name>
<value>root</value>
</property>
<!-- 关闭schema验证-->
<property>
<name>hive.metastore.schema.verification</name>
<value>false</value>
</property>
<!-- 提示当前库名 -->
<property>
<name>hive.cli.print.current.db</name>
<value>true</value>
</property>
<!-- 查询输出显示列名 -->
<property>
<name>hive.cli.print.header</name>
<value>true</value>
</property>
</configuration>
Copy the driver of mysql8 to the /opt/soft/hive312/lib directory
cp /opt/install/mysql-connector-java-8.0.29.jar /opt/soft/hive312/lib
Four update guava
The following commands are executed in the hive312/lib directory
cd /opt/soft/hive312/lib/
Delete the guava file in this directory
rm -rf ./guava-19.0.jar
Copy the guava file in hadoop
cp /opt/soft/hadoop313/share/hadoop/common/lib/guava-27.0-jre.jar ./
look at the file again
find ./ -name guava*
Five hive initialization
Hadoop, mysql services must be started
initialization command
schematool -dbType mysql -initSchema
Enter hive to see if the installation is successful
hive
Appears similar to even if successful
hive (default)>
Create a database try
hive (default)> show databases;
OK
database_name
default
创建数据库
hive (default)> create database kb23DB;
退出数据库
hive (default)> quit
Six open remote connection
cd /opt/soft/hive312
It is normal for some warnings to appear in the following commands
metadata service
nohup hive --service metastore &
hive remote service
nohup hive --service hiveserver2 &
Connect to hive service through beeline
beeline -u jdbc:hive2://localhost:10000
Seven use datagrip to connect to hive
After completing the above steps, you can use datagrip to connect to hive
There is no need to write the user name and password here, they are all empty