Zookeeper 集群配置

一、概念

https://zookeeper.apache.org/doc/r3.4.13/zookeeperStarted.html

replicated mode:复制模式,A replicated group of servers in the same application is called a quorum, and in replicated mode, all servers in the quorum have copies of the same configuration file

二、docker部署

编写stack.yml:见https://hub.docker.com/_/zookeeper

swarm启动:docker stack deploy -c stack.yml zookeeper

docker-compose启动:docker-compose -f stack.yml up

一个服务挂了,docker swarm会自动重启

三、配置讲解

clientPort=2181
dataDir=/data
dataLogDir=/datalog
tickTime=2000
initLimit=5
syncLimit=2
server.1=0.0.0.0:2888:3888
server.2=zoo2:2888:3888
server.3=zoo3:2888:3888
  • server.X : When the server starts up, it knows which server it is by looking for the file myid  in the data directory. That file has the contains the server number, in ASCII(between 1 and 255)

  • 端口用途

    • 2181:对client端提供服务

    • 2888:集群内机器通讯使用(Leader监听此端口)

    • 3888:选举leader使用

四、注意事项

转载于:https://my.oschina.net/cectsky/blog/3011759

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值