zookeeper分布式集群

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了zookeeper分布式集群相关的知识,希望对你有一定的参考价值。

简介

zookeeper:分布式协调应用程序
官方网站:http://zookeeper.apache.org/

最新版本:3.4.13
下载地址:https://mirrors.tuna.tsinghua.edu.cn/apache/zookeeper/zookeeper-3.4.13/zookeeper-3.4.13.tar.gz

安装部署

vim /etc/hosts
192.168.33.14 node4
192.168.33.15 node5
192.168.33.16 node6

下载安装

yum -y install java
yum -y install wget 
wget https://mirrors.tuna.tsinghua.edu.cn/apache/zookeeper/zookeeper-3.4.13/zookeeper-3.4.13.tar.gz
tar xf zookeeper-3.4.13.tar.gz 
mv zookeeper-3.4.13 /usr/local/zookeeper

配置

mv /usr/local/zookeeper/conf/zoo{_sample,}.cfg
cat >> /usr/local/zookeeper/conf/zoo.cfg<<EOF
server.1 = node4:2888:3888
server.2 = node5:2888:3888
server.3 = node6:2888:3888
EOF

node4:
echo 1 > /tmp/zookeeper/myid
node5:
echo 2 > /tmp/zookeeper/myid
node6:
echo 3 > /tmp/zookeeper/myid

启动集群

cd /usr/local/zookeeper/bin && ./zkServer.sh start

查看集群节点状态

查看下面的信息说明集群配置正常,如果不正常,查看日志文件/usr/local/zookeeper/bin/zookeeper.out

./zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /usr/local/zookeeper/bin/../conf/zoo.cfg
Mode: leader

以上是关于zookeeper分布式集群的主要内容,如果未能解决你的问题,请参考以下文章

zookeeper(单机伪集群集群)部署

zookeeper(单机伪集群集群)部署

Zookeeper集群安装部署

ZooKeeper的伪分布式集群搭建

架构设计 | 分布式系统调度,Zookeeper集群化管理

zookeeper集群搭建