diff --git a/content/post/hbase.md b/content/post/hbase.md new file mode 100644 index 0000000..5884945 --- /dev/null +++ b/content/post/hbase.md @@ -0,0 +1,130 @@ +--- +title: "hbase 部署" +date: 2023-05-23T18:00:00+08:00 +lastmod: 2025-12-01T10:00:00+08:00 +keywords: [] +tags: ["hadoop", "hbase"] +categories: ["hadoop"] +--- + +## 环境 +操作系统 | 主机名 | 地址 | 运行组件 +---- | ---- | ---- | ---- +Rocky9 | hbase-m30 | 192.168.8.30/24 | hbase Master +Rocky9 | hbase-bm31 | 192.168.8.31/24 | hbase Backup Master +Rocky9 | hbase-rs32 | 192.168.8.32/24 | hbase Rigion Server +Rocky9 | hbase-rs33 | 192.168.8.33/24 | hbase Rigion Server + +## 前提 +- [已部署好 hadoop 2.10](/post/hdp2) +- [已部署好 zookeeper 3.4 以上版本](/post/zk-install) + +## 服务器初始配置 +- 在**全部主机**上执行如下操作 +- 禁用防火墙 +- 禁用 selinux +- 配置时间同步 +- 配置主机名解析 + ```bash + echo "192.168.8.1 hdp-nn" >> /etc/hosts + echo "192.168.8.2 hdp-snn" >> /etc/hosts + 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.30 hbase-m30" >> /etc/hosts + echo "192.168.8.31 hbase-bm31" >> /etc/hosts + echo "192.168.8.32 hbase-region32" >> /etc/hosts + echo "192.168.8.33 hbase-region33" >> /etc/hosts + ``` + +## ssh 免密登录 +- 配置 **hbase-m30** 可以 ssh 免密登录 hbase-m30、hbase-bm31 和 hbase-rsXX + ```bash + # 在 hbase-m30 上执行如下操作 + ssh-copy-id hbase-m30 + ssh-copy-id hbase-bm31 + ssh-copy-id hbase-rs32 + ssh-copy-id hbase-rs33 + ``` + +## 复制 jdk 和 hadoop 环境 +- 在**全部主机**上执行如下操作 +- 从 **hdp-nn** 复制 jdk 和 hadoop 环境 + ```bash + scp -r hdp-nn:/opt/{jdk,hdp} /opt/ + scp hdp-nn:/etc/profile.d/{jdk,hdp}.sh /etc/profile.d/ + source /etc/profile.d/jdk.sh + source /etc/profile.d/hdp.sh + ``` + +## 部署 hbase 环境 +- 在**全部主机**上执行如下操作 +- 下载 hbase 2.5.13 部署包,解压 + ```bash + curl -LO https://mirrors.tuna.tsinghua.edu.cn/apache/hbase/2.5.13/hbase-2.5.13-bin.tar.gz + tar zxf hbase-2.5.13-bin.tar.gz + mv hbase-2.5.13 /opt/hbase + ``` + +- 配置环境变量 + ```bash + echo 'export HBASE_HOME=/opt/hbase' > /etc/profile.d/hbase.sh + echo 'export PATH=$HBASE_HOME/bin:$PATH' >> /etc/profile.d/hbase.sh + source /etc/profile.d/hbase.sh + ``` + +### 修改 hbase-env.sh +- 编辑 $HBASE_HOME/conf/hbase-env.sh,指定如下三个环境变量 + ```bash + export JAVA_HOME=/opt/jdk + export HBASE_CLASSPATH=$HADOOP_HOME/etc/hadoop + export HBASE_MANAGES_ZK=false + ``` + +### 创建 hbase-site.xml +- 清空 $HBASE_HOME/conf/hbase-site.xml,添加如下内容 + ```xml + + + + hbase.cluster.distributed + true + + + + hbase.rootdir + hdfs://hdp-nn-21:8020/hbase + + + + hbase.zookeeper.quorum + zk1,zk2,zk3 + + + ``` + +### 修改 regionservers +- 清空 $HBASE_HOME/conf/regionservers,添加如下内容 + ``` + hbase-rs32 + hbase-rs33 + ``` + +### 创建 backup-masters +- 创建 $HBASE_HOME/conf/backup-masters,添加如下内容 + ``` + hbase-bm31 + ``` + +## 启动 hbase +- 在 **hbase-m30** 上启动 hbase 集群 + ```bash + start-hbase.sh + ``` + +## 客户端连接 +- 本地直接进入 hbase shell + ```bash + hbase shell + ``` + diff --git a/content/post/hdp2.md b/content/post/hdp2.md index a1ed1e8..2c1fe47 100644 --- a/content/post/hdp2.md +++ b/content/post/hdp2.md @@ -230,7 +230,7 @@ Rocky9 | hdp-slave11 | 192.168.8.11/24 | /data/hdp-dn | Datanode, NodeManager ### 修改 slaves - 编辑 $HADOOP_HOME/etc/hadoop/slaves,替换成全部的 slave 主机,参考内容如下 - ```txt + ``` hdp-slave10 hdp-slave11 ``` diff --git a/content/post/hive2-tez.md b/content/post/hive2-tez.md index 28c60b9..9deed28 100644 --- a/content/post/hive2-tez.md +++ b/content/post/hive2-tez.md @@ -14,6 +14,10 @@ Rocky8 | 编译服务器 | - | 编译工具 Rocky9 | hive-hs20 | 192.168.8.20/24 | Hive Server, Tez Rocky9 | hive-ms21 | 192.168.8.21/24 | Hive Metastore, MySQL8.0, Tez +## 前提 +- [已部署好 hadoop 2.10](/post/hdp2) +- [已部署好 hive 2.3.10](/post/hive2) + ## 准备 protoc 2.5.0 环境 - 在**编译服务器**上执行如下操作 - 下载源码,解压 diff --git a/content/post/hive2.md b/content/post/hive2.md index 88e67d5..087e5ca 100644 --- a/content/post/hive2.md +++ b/content/post/hive2.md @@ -11,7 +11,11 @@ categories: ["hadoop"] 操作系统 | 主机名 | 地址 | 运行组件 ---- | ---- | ---- | ---- Rocky9 | hive-hs20 | 192.168.8.20/24 | Hive Server -Rocky9 | hive-ms21 | 192.168.8.21/24 | Hive Metastore, MySQL8.0 +Rocky9 | hive-ms21 | 192.168.8.21/24 | Hive Metastore + +## 前提 +- [已部署好 hadoop 2.10](/post/hdp2) +- [已部署好 mysql 8](/post/mysql-install/#安装-mysql84-通用二进制包) ## 服务器初始配置 - 在**全部主机**上执行如下操作 @@ -30,9 +34,7 @@ Rocky9 | hive-ms21 | 192.168.8.21/24 | Hive Metastore, MySQL8.0 ``` ## 创建 mysql 数据库 -- 在 **hive-ms21** 上执行如下操作 -- 部署 mysql8.0,略过 -- 创建用户及其数据库,参考 sql 如下 +- 在 **mysql** 创建用户及其数据库,参考 sql 如下 ```sql create user hive@'%' identified by 'Hive_1234'; create database hive default charset utf8mb4; @@ -41,7 +43,7 @@ Rocky9 | hive-ms21 | 192.168.8.21/24 | Hive Metastore, MySQL8.0 ## 复制 jdk 和 hadoop 环境 - 在**全部主机**上执行如下操作 -- 从 hdp-nn 复制 jdk 和 hadoop 环境 +- 从 **hdp-nn** 复制 jdk 和 hadoop 环境 ```bash scp -r hdp-nn:/opt/{jdk,hdp} /opt/ scp hdp-nn:/etc/profile.d/{jdk,hdp}.sh /etc/profile.d/ @@ -86,7 +88,7 @@ Rocky9 | hive-ms21 | 192.168.8.21/24 | Hive Metastore, MySQL8.0 javax.jdo.option.ConnectionURL - jdbc:mysql://hive-ms21:3306/hive?createDatabaseIfNotExist=true&useSSL=false + jdbc:mysql://mysql-ip:3306/hive?createDatabaseIfNotExist=true&useSSL=false