centos7安装hive,hive版本3.1.2
将压缩包复制到/opt/software目录下,并解压至/opt/module/目录
tar -zxf ./apache-hive-3.1.2-bin.tar.gz -C /opt/module/
进入/opt/module/目录,将apache-hive-3.1.2-bin改为hive312
cd /opt/module/
mv ./apache-hive-3.1.2-bin/ hive312
修改/etc/profile文件
vim /etc/profile
在最下方加入
#hive
export HIVE_HOME=/opt/module/hive312
export PATH=$HIVE_HOME/bin:$PATH
改完文件保存并退出,source环境变量
source /etc/profile
进入/opt/module/hive312/conf/目录
cd /opt/module/hive312/conf/
将模板文件hive-default.xml.template改名为hive-default.xml
mv hive-default.xml.template hive-default.xml
创建hive-site.xml文件
vim ./hive-site.xml
- "1.0" encoding="UTF-8" standalone="no"?>
- "text/xsl" href="configuration.xsl"?>
-
- <configuration>
- <property>
- <name>hive.metastore.warehouse.dirname>
- <value>/hive312/warehousevalue>
- property>
- <property>
- <name>hive.metastore.db.typename>
- <value>mysqlvalue>
- property>
- <property>
- <name>javax.jdo.option.ConnectionURLname>
- <value>jdbc:mysql://192.168.153.135:3306/hive135?createDatabaseIfNotExist=truevalue>
- property>
- <property>
- <name>javax.jdo.option.ConnectionDriverNamename>
- <value>com.mysql.cj.jdbc.Drivervalue>
- property>
- <property>
- <name>javax.jdo.option.ConnectionUserNamename>
- <value>rootvalue>
- property>
- <property>
- <name>javax.jdo.option.ConnectionPasswordname>
- <value>123456value>
- property>
- <property>
- <name>hive.metastore.schema.verificationname>
- <value>falsevalue>
- property>
- <property>
- <name>hive.cli.print.current.dbname>
- <value>truevalue>
- property>
- <property>
- <name>hive.cli.print.headername>
- <value>truevalue>
- property>
- configuration>
将MySQL8的驱动拷贝到/opt/module/hive312/lib目录下
删除lib目录下的guava-19.0.jar
rm -rf ./guava-19.0.jar
将/opt/module/hadoop-3.1.3/share/hadoop/common/lib中guava-27.0-jre.jar拷贝至/opt/module/hive312/lib目录(当前目录)
cp /opt/module/hadoop-3.1.3/share/hadoop/common/lib/guava-27.0-jre.jar ./
schematool -dbType mysql -initSchema
输入hive进入默认库
开启元数据服务
nohup hive --service metastore &
开启hive远程服务
nohup hive --service hiveserver2 &
启动beeline客户端
beeline -u jdbc:hive2://localhost:10000