文章目录
- 1、下载hive
- 2、安装hadoop(略)
- 3、安装mysql(略)
- 4、安装
1、下载hive
https://dlcdn.apache.org/hive/hive-3.1.3/
2、安装hadoop(略)
3、安装mysql(略)
4、安装
解压
tar -zvxf apache-hive-3.1.3-bin.tar.gz
mv apache-hive-3.1.3-bin hive313
修改环境变量
vi /etc/profile
添加
export HIVE_HOME=/opt/soft/hive/hive313
export PATH=$PATH:$HIVE_HOME/bin
在hive313/conf下新建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/hive/hive313/data</value>
</property>
<property>
<name>hive.metastore.db.type</name>
<value>mysql</value>
</property>
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:mysql://172.16.10.169:3306/hive_meta?createDatabaseIfNotExist=true&useUnicode=true&characterEncoding=UTF-8</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>root</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的驱动放入hive313/lib下
执行数据元初始化
schematool -dbType mysql -initSchema
启动,执行命令:
nohup hive --service hiveserver2 &
beeline -u jdbc:hive2://172.16.10.169:10000
访问http://:10002
如果创建表的注释有乱码问题,修改mysql元数据表中COLUMN_V2、TABLE_PARAMS表中对应列的编码格式为UTF8
停止的脚本为stop-hive.sh
#!/bin/bash
process="hive"
PID=$(ps x | grep $process | grep '/bin/java' | grep -v grep | awk '{print $1}')
ps -ef | grep $process | grep '/bin/java' | grep -v grep | awk '{print $2}' | xargs kill -9
Dbeaver连接hive的方式:
https://blog.csdn.net/m0_62617719/article/details/128338137