From 196342d9b8acf820c2974f912b3561c16b0e41d4 Mon Sep 17 00:00:00 2001 From: colben Date: Wed, 25 Mar 2026 21:56:21 +0800 Subject: [PATCH] update --- content/post/hdp2.md | 33 ++++++++++++++++++++++----------- content/post/hive2-tez.md | 15 +++------------ content/post/hive2.md | 24 +++++++++++------------- 3 files changed, 36 insertions(+), 36 deletions(-) diff --git a/content/post/hdp2.md b/content/post/hdp2.md index ea59ad7..da05635 100644 --- a/content/post/hdp2.md +++ b/content/post/hdp2.md @@ -173,6 +173,16 @@ Rocky9 | hdp-slave11 | 192.168.8.11/24 | /data/hdp-dn | Datanode, NodeManager yarn.resourcemanager.webapp.address hdp-rm:8088 + + yarn.nodemanager.resource.cpu-vcores + 6 + + + + yarn.nodemanager.resource.memory-mb + 12288 + --> yarn.log-aggregation-enable @@ -226,27 +236,25 @@ Rocky9 | hdp-slave11 | 192.168.8.11/24 | /data/hdp-dn | Datanode, NodeManager ``` ### 创建临时目录和数据目录 -- 在 **hdp-nn** 上创建临时目录和数据目录 +- 在 **hdp-nn** 上创建数据目录 ```bash - mkdir /tmp/hdp mkdir /data/hdp_nn ``` -- 在 **hdp-snn** 上创建临时目录和数据目录 +- 在 **hdp-snn** 上创建数据目录 ```bash - mkdir /tmp/hdp mkdir /data/hdp_snn ``` -- 在 **hdp-rm** 上创建临时目录 - ```bash - mkdir /tmp/hdp - ``` - - 在 **hdp-slaveXX** 上创建临时目录和数据目录 ```bash - mkdir /tmp/hdp #建议挂载独立盘 - mkdir /data/hdp_dn #建议挂载独立盘 + mkdir /tmp/hdp /data/hdp_dn #建议都挂载独立盘 + ``` + +### 格式化 namenode +- 在 **hdp-nn** 上执行如下操作 + ```bash + hdfs namenode -format ``` ## 启动 hadoop 集群 @@ -260,3 +268,6 @@ Rocky9 | hdp-slave11 | 192.168.8.11/24 | /data/hdp-dn | Datanode, NodeManager /opt/hdp/sbin/start-yarn.sh ``` +## 参考 +- [https://www.cnblogs.com/jpSpaceX/articles/15032931.html](https://www.cnblogs.com/jpSpaceX/articles/15032931.html) + diff --git a/content/post/hive2-tez.md b/content/post/hive2-tez.md index 40973ba..6811bee 100644 --- a/content/post/hive2-tez.md +++ b/content/post/hive2-tez.md @@ -51,18 +51,12 @@ Rocky9 | hive-ms21 | 192.168.8.21/24 | Hive Metastore, MySQL8.0, Tez - 上传 tez-dist/target/tez-0.9.2.tar.gz 到 **hive-hs20** 中 ## 部署 tez 环境 -- 在 **hive-hs20** 执行如下操作 -- 上传 tez-0.9.2.tar.gz 到 hdfs +- 在 **hive-hs20** 上 put tez-0.9.2.tar.gz 到 hdfs ```bash hdfs dfs -mkdir /tez hdfs dfs -put tez-0.9.2.tar.gz /tez/ ``` -- 创建 tez staging 目录 - ```bash - hdfs dfs -mkdir -p /hive/tez/staging - ``` - - 在**全部 hive 主机**上解压 tez 部署包 ```bash mkdir /opt/tez @@ -86,10 +80,6 @@ Rocky9 | hive-ms21 | 192.168.8.21/24 | Hive Metastore, MySQL8.0, Tez ``` -### 修改 hive-site.xml -- 在**全部 hive 主机**上执行如下操作 -- 参考[在 $HIVE_HOME/etc/hadoop/yarn-site.xml 中配置 tez staging 目录](/post/hive2/#创建-hive-sitexml) - ### 修改 hive-env.sh - 在**全部 hive 主机**上执行如下操作 - 编辑 $HIVE_HOME/conf/hive-env.sh,在文件最后增加如下内容 @@ -111,8 +101,9 @@ Rocky9 | hive-ms21 | 192.168.8.21/24 | Hive Metastore, MySQL8.0, Tez - 重启 hive metastore 和 hiveserver2 ## 设置引擎 -- 设置 hive 引擎为 tez,执行 sql 语句 +- 客户端连接 hive,设置引擎为 tez,执行 sql 语句 ```sql set hive.execution.engine=tez; + -- 后面操作数据时不再报 "WARNING: Hive-on-MR is deprecated in Hive 2 ..." ``` diff --git a/content/post/hive2.md b/content/post/hive2.md index 5d4a86b..8f7dde2 100644 --- a/content/post/hive2.md +++ b/content/post/hive2.md @@ -25,8 +25,8 @@ Rocky9 | hive-ms21 | 192.168.8.21/24 | Hive Metastore, MySQL8.0 echo "192.168.8.3 hdp-dn" >> /etc/hosts echo "192.168.8.10 hdp-slave10" >> /etc/hosts echo "192.168.8.11 hdp-slave11" >> /etc/hosts - echo "192.168.8.20 hdp-hs20" >> /etc/hosts - echo "192.168.8.21 hdp-ms21" >> /etc/hosts + echo "192.168.8.20 hive-hs20" >> /etc/hosts + echo "192.168.8.21 hive-ms21" >> /etc/hosts ``` ## 创建 mysql 数据库 @@ -34,9 +34,9 @@ Rocky9 | hive-ms21 | 192.168.8.21/24 | Hive Metastore, MySQL8.0 - 部署 mysql8.0,略过 - 创建用户及其数据库,参考 sql 如下 ```sql - create user hive@127.7.7.7 identified by 'Hive_1234'; + create user hive@'%' identified by 'Hive_1234'; create database hive default charset utf8mb4; - grant all on hive.* to hive@127.7.7.7; + grant all on hive.* to hive@'%'; ``` ## 复制 jdk 和 hadoop 环境 @@ -54,8 +54,8 @@ Rocky9 | hive-ms21 | 192.168.8.21/24 | Hive Metastore, MySQL8.0 - 下载 hive 2.3.9 部署包,解压 ```bash curl -LO https://archive.apache.org/dist/hive/hive-2.3.9/apache-hive-2.3.9-bin.tar.gz - tar zxf apache-hive-2.3.9.tar.gz - mv apache-hive-2.3.9 /opt/hive + tar zxf apache-hive-2.3.9-bin.tar.gz + mv apache-hive-2.3.9-bin /opt/hive ``` - 下载 mysql 连接库,解压到 hive 库目录下 @@ -76,7 +76,7 @@ Rocky9 | hive-ms21 | 192.168.8.21/24 | Hive Metastore, MySQL8.0 ### 修改 hive-env.sh - 编辑 $HIVE_HOME/conf/hive-env.sh,指定 HADOOP_HOME 环境变量 ```bash - export HADOOP_HOME=/opt/hdp + HADOOP_HOME=/opt/hdp ``` ### 创建 hive-site.xml @@ -86,7 +86,7 @@ Rocky9 | hive-ms21 | 192.168.8.21/24 | Hive Metastore, MySQL8.0 javax.jdo.option.ConnectionURL - jdbc:mysql://127.7.7.7:3306/hive?createDatabaseIfNotExist=true&useSSL=false + jdbc:mysql://hive-ms21:3306/hive?createDatabaseIfNotExist=true&useSSL=false @@ -136,14 +136,10 @@ Rocky9 | hive-ms21 | 192.168.8.21/24 | Hive Metastore, MySQL8.0 hive.execution.engine tez --> - - tez.am.staging-dir - /hive/tez/staging - ``` -## 初始化 hive 库 +### 初始化 hive 库 - 在 **hive-ms21** 上执行如下操作 ```bash schematool -dbType mysql -initSchema @@ -164,10 +160,12 @@ Rocky9 | hive-ms21 | 192.168.8.21/24 | Hive Metastore, MySQL8.0 - 本地直接连接 ```bash hive + # 暂时忽略"WARNING: Hive-on-MR is deprecated in Hive 2 ..." ``` - beeline 连接,需要[在 $HADOOP_HOME/etc/hadoop/core-site.xml 中配置 proxyuser](/post/hdp2/#修改-core-sitexml) ```bash beeline -u jdbc:hive2://hive-hs20:10000 -n root + # 暂时忽略"WARNING: Hive-on-MR is deprecated in Hive 2 ..." ```