Hive集群部署指导文档(上)
作者:互联网
1. 环境及安装包信息
系统:CentOS 7.6
jdk-8u251-linux-x64.tar.gz
apache-zookeeper-3.6.1-bin.tar.gz
hadoop-3.1.3.tar.gz
Mysql 5.7.30
apache-hive-3.1.2-bin.tar.gz
安装包下载地址:
https://www.oracle.com/java/technologies/javase/javase-jdk8-downloads.html
https://www.apache.org/dyn/closer.lua/zookeeper/zookeeper-3.6.1/
https://www.apache.org/dyn/closer.cgi/hadoop/common/hadoop-3.3.0/
https://dev.mysql.com/downloads/mysql/
https://mirrors.bfsu.edu.cn/apache/hive/hive-3.1.2/
2. 节点免密配置
示例节点:
IP 主机名
192.168.0.131 openlookeng-gz-gh-0001 (master)
192.168.0.200 openlookeng-gz-gh-0002 (worker)
192.168.0.158 openlookeng-gz-gh-0003 (worker)
2.1 在每个节点生成秘钥
ssh-keygen 【enter】【enter】【enter】 (即输入ssh-keygen后敲三次【enter】键)
2.2 将每台机器的公钥复制到master节点
scp ~/.ssh/id_rsa.pub root@192.168.0.131:~/.ssh/id_rsa.pub_worker1 (192.168.0.200上执行)
scp ~/.ssh/id_rsa.pub root@192.168.0.131:~/.ssh/id_rsa.pub_worker2 (192.168.0.158上执行)
2.3 master上将公钥追加到authorized_keys中
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
cat ~/.ssh/id_rsa.pub_worker1 >> ~/.ssh/authorized_keys
cat ~/.ssh/id_rsa.pub_worker2 >> ~/.ssh/authorized_keys
2.4 将Master中的authorized_keys拷贝到其它节点
scp ~/.ssh/authorized_keys root@192.168.0.200:~/.ssh/authorized_keys
scp ~/.ssh/authorized_keys root@192.168.0.158:~/.ssh/authorized_keys
设置成功,然后就可以免密啦~~~
3. 安装jdk
3.1 将jdk-8u251-linux-x64.tar.gz解压至/opt目录
tar -zxvf jdk-8u251-linux-x64.tar.gz -C /opt
3.2 添加环境变量
vi /etc/profile
export JAVA_HOME=/opt/jdk1.8.0_251
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$JAVA_HOME/bin:$PATH
source /etc/profile
3.3 执行java -version进行验证
[root@openlookeng-gz-gh-0001 ~]# java -version
java version "1.8.0_251"
Java(TM) SE Runtime Environment (build 1.8.0_251-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.251-b09, mixed mode)
[root@openlookeng-gz-gh-0001 ~]#
4 搭建Zookeeper
4.1 解压安装包并修改解压后的文件夹名
将zookeeper安装包解压至master的/opt目录:
tar -zxvf apache-zookeeper-3.6.1-bin.tar.gz -C /opt
cd /opt && mv apache-zookeeper-3.6.1-bin zookeeper
4.2 配置环境变量
vi /etc/profile
export ZOOKEEPER_HOME=/opt/zookeeper
export PATH=$JAVA_HOME/bin:$ZOOKEEPER_HOME/bin:$PATH
source /etc/profile
4.3修改配置
进入zookeeper配置文件目录:
cd /opt/zookeeper/conf/
cp zoo_sample.cfg zoo.cfg
修改zoo.cfg文件:
修改dataDir目录:dataDir=/srv/data1/zookeeper/tmp (根据具体情况修改)
并增加如下配置:
server.1=openlookeng-gz-gh-0001:2888:3888
server.2=openlookeng-gz-gh-0002:2888:3888
server.3=openlookeng-gz-gh-0003:2888:3888
(注:openlookeng-gz-gh-0001、openlookeng-gz-gh-0002、openlookeng-gz-gh-0003分别为集群各节点的主机名。)
创建dataDir目录并创建文件:
mkdir -p /srv/data1/zookeeper/tmp
touch /srv/data1/zookeeper/tmp/myid
echo 1 > /srv/data1/zookeeper/tmp/myid
4.4配置其它节点
将master解压并修改名称后的zookeeper文件夹传至其它节点上:
scp -r /opt/zookeeper root@192.168.0.200:/opt
scp -r /opt/zookeeper root@192.168.0.158:/opt
配置环境变量,同4.2
分别在192.168.0.200和192.168.0.158上执行如下:
192.168.0.200节点上:
mkdir -p /srv/data1/zookeeper/tmp
touch /srv/data1/zookeeper/tmp/myid
echo 2 > /srv/data1/zookeeper/tmp/myid
192.168.0.158节点上:
mkdir -p /srv/data1/zookeeper/tmp
touch /srv/data1/zookeeper/tmp/myid
echo 3 > /srv/data1/zookeeper/tmp/myid
4.5 启动zookeeper
在每个节点上执行如下命令:
zkServer.sh start
查看服务状态: zkServer.sh status
[root@openlookeng-gz-gh-0002 opt]# zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /opt/zookeeper/bin/../conf/zoo.cfg
Client port found: 2181. Client address: localhost.
Mode: follower
(三个节点的mode分别为一个leader和两个follower)
标签:opt,openlookeng,192.168,zookeeper,gz,Hive,集群,ssh,文档 来源: https://blog.csdn.net/qq_24876715/article/details/110433129