mac hive安装
Last updated on February 21, 2025 am
🧙 Questions
mac的m2版本hadoop安装 3.3.5版本
☄️ Ideas
前提安装hadoop
下载安装hadoop
mkdir -p /Users/ispong/hive
tar -vzxf /Users/ispong/OneDrive/Downloads/linux/hive/apache-hive-3.1.3-bin.tar.gz -C /Users/ispong/hive
配置系统环境
tee -a ~/.zshrc <<-'EOF'
export HIVE_HOME=/Users/ispong/hive/apache-hive-3.1.3-bin
export PATH=$PATH:$HIVE_HOME/bin
EOF
source ~/.zshrc
检测安装
hive --version
配置日志存储位置hive-log4j2.properties
mkdir -p /Users/ispong/hive/apache-hive-3.1.3-bin/logs
cp /Users/ispong/hive/apache-hive-3.1.3-bin/conf/hive-log4j2.properties.template /Users/ispong/hive/apache-hive-3.1.3-bin/conf/hive-log4j2.properties
code /Users/ispong/hive/apache-hive-3.1.3-bin/conf/hive-log4j2.properties
property.hive.log.dir=/Users/ispong/hive/apache-hive-3.1.3-bin/logs
修改环境文件hive-env.sh
cp /Users/ispong/hive/apache-hive-3.1.3-bin/conf/hive-env.sh.template /Users/ispong/hive/apache-hive-3.1.3-bin/conf/hive-env.sh
tee -a /Users/ispong/hive/apache-hive-3.1.3-bin/conf/hive-env.sh <<-'EOF'
export HADOOP_HOME=/Users/ispong/hadoop/hadoop-3.3.5
export HIVE_CONF_DIR=/Users/ispong/hive/apache-hive-3.1.3-bin/conf
EOF
创建临时文件夹
mkdir -p /Users/ispong/hive/tmp
配置hive-site.xml文件
重点一定要先删除
3.1.3版本修改文件前需要删除[3215,9]
3215行删掉描述
cp /Users/ispong/hive/apache-hive-3.1.3-bin/conf/hive-default.xml.template /Users/ispong/hive/apache-hive-3.1.3-bin/conf/hive-site.xml
code /Users/ispong/hive/apache-hive-3.1.3-bin/conf/hive-site.xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
<!-- ispong :) beeline username -->
<property>
<name>hive.server2.thrift.client.user</name>
<value>ispong</value>
<description>Username to use against thrift client</description>
</property>
<!-- ispong :) beeline password -->
<property>
<name>hive.server2.thrift.client.password</name>
<value>ispong123</value>
<description>Password to use against thrift client</description>
</property>
<!-- ispong :) 直接新增 -->
<property>
<name>system:java.io.tmpdir</name>
<value>/Users/ispong/hive/tmp</value>
</property>
<!-- ispong :) 直接新增 -->
<property>
<name>system:user.name</name>
<value>ispong</value>
</property>
<property>
<name>javax.jdo.option.ConnectionURL</name>
<value>jdbc:derby:/Users/ispong/hive/derby;databaseName=metastore_db;create=true;AUTO_SERVER=TRUE</value>
<description>
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.
</description>
</property>
<property>
<name>hive.druid.metadata.db.type</name>
<value>derby</value>
<description>
Expects one of the pattern in [mysql, postgresql, derby].
Type of the metadata database.
</description>
</property>ï
</configuration>
升级guava版本
- 3.1.3版本
rm /opt/hive/lib/guava-*.jar
cp /opt/hadoop/share/hadoop/hdfs/lib/guava-*.jar /opt/hive/lib/
初始化元数据
hive --service schemaTool -initSchema -dbType derby
启动hive
nohup hive >> /Users/ispong/hive/apache-hive-3.1.3-bin/logs/hive.log 2>&1 &
tail -f /Users/ispong/hive/apache-hive-3.1.3-bin/logs/hive.log
查看服务是否开启
# 查看 metastore,进程号
pgrep -f "org.apache.hadoop.hive.metastore.HiveMetaStore"
# 查看端口号
netstat -nap | grep 36856
# 查看端口号状态
netstat -ntpl | grep 9083
# hiveserver2
pgrep -f "org.apache.hive.service.server.HiveServer2"
netstat -nap | grep 36856
netstat -ntpl | grep 40005
关闭hive
# 关闭metastore
kill -9 47404
# 关闭hiveserver2
kill -9 48001
测试
# thrift://127.0.0.1:9083
# jdbc:hive2://127.0.0.1:40005/isxcode_db
# ispong
beeline -n ispong -p ispong123 -u jdbc:hive2://localhost:10000
create database isxcode_db;
元数据链接信息
🔗 Links
mac hive安装
https://ispong.isxcode.com/os/mac/mac hive安装/