ZooKeepper-3.4.14安装
节点 | NameNode | DataNode | ZooKeeper | ZKFC | JournalNode | ResourceManager | NodeManager |
---|
nn1 | ★ | | | ★ | | ★ | |
nn2 | ★ | | | ★ | | ★ | |
dn1 | | ★ | ★ | | ★ | | ★ |
dn2 | | ★ | ★ | | ★ | | ★ |
dn3 | | ★ | ★ | | ★ | | ★ |
- 下载zookeeper-3.4.14压缩包-华中科技大学镜像
- 将文件上传到dn1、dn2、dn3三台节点~/pkg目录下
- 执行以下命令,在dn1、dn2、dn3三台节点安装zookeeper
ssh dn1 tar -zxvf ~/pkg/zookeeper-3.4.14.tar.gz -C /opt
ssh dn2 tar -zxvf ~/pkg/zookeeper-3.4.14.tar.gz -C /opt
ssh dn3 tar -zxvf ~/pkg/zookeeper-3.4.14.tar.gz -C /opt
ssh dn1 ln -sf /opt/zookeeper-3.4.14 /opt/zookeeper
ssh dn2 ln -sf /opt/zookeeper-3.4.14 /opt/zookeeper
ssh dn3 ln -sf /opt/zookeeper-3.4.14 /opt/zookeeper
- 修改dn1环境变量,之后分发到dn2和dn3
vim /etc/profile
export ZOOKEEPER_HOME=/opt/zookeeper
export PATH=$PATH:$ZOOKEEPER_HOME/bin
scp -r /etc/profile dn2:/etc
scp -r /etc/profile dn3:/etc
ssh dn1 source /etc/profile
ssh dn2 source /etc/profile
ssh dn3 source /etc/profile
- zookeeper设置
cp /opt/zookeeper/conf/zoo_sample.cfg /opt/zookeeper/conf/zoo.cfg
tickTime=2000
dataDir=/opt/data/zookeeper
clientPort=2181
initLimit=5
syncLimit=2
server.1=dn1:2888:3888
server.2=dn2:2888:3888
server.3=dn3:2888:3888
scp -r /opt/zookeeper/conf/zoo_sample.cfg dn2:/opt/zookeeper/conf/zoo_sample.cfg
scp -r /opt/zookeeper/conf/zoo_sample.cfg dn3:/opt/zookeeper/conf/zoo_sample.cfg
scp -r /opt/zookeeper/conf/zoo.cfg dn2:/opt/zookeeper/conf/zoo.cfg
scp -r /opt/zookeeper/conf/zoo.cfg dn3:/opt/zookeeper/conf/zoo.cfg
ssh dn1 mkdir -p /opt/data/zookeeper
ssh dn2 mkdir -p /opt/data/zookeeper
ssh dn3 mkdir -p /opt/data/zookeeper
zkServer.sh start
zkServer.sh status
- 查看三台节点zookeeper状态发现,一台节点为leader,两台为follower
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/b1a94c6adbbe0bc3bc5f72a4ac08eb87.png)
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/5b32559a6dd4c4c722f9f7bac7077142.png)
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/5562f7b6a376764f39b85828d9d2e6d3.png)
- 对dn1、dn2、dn3节点进行快照