三台虚拟机搭建集群

来源:5-3 三台物理机(虚拟机)安装zookeeper集群

慕标1714062

2018-04-11

zoo.cfg 配置

# The number of milliseconds of each tick

tickTime=2000

# The number of ticks that the initial

# synchronization phase can take

initLimit=10

# The number of ticks that can pass between

# sending a request and getting an acknowledgement

syncLimit=5

# the directory where the snapshot is stored.

# do not use /tmp for storage, /tmp here is just

# example sakes.

dataDir=/usr/local/zookeeper/dataDir

dataLogDir=/usr/local/zookeeper/dataLogDir

# the port at which the clients will connect

clientPort=21810

# the maximum number of client connections.

# increase this if you need to handle more clients

#maxClientCnxns=60

#

# Be sure to read the maintenance section of the

# administrator guide before turning on autopurge.

#

# http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance

#

# The number of snapshots to retain in dataDir

#autopurge.snapRetainCount=3

# Purge task interval in hours

# Set to "0" to disable auto purge feature

#autopurge.purgeInterval=1

server.1= 192.168.135.128:2887:3887

server.2= 192.168.135.129:2887:3887

server.3= 192.168.135.130:2887:3887


最后为什么是我130这台server.3是leader,竞争的时候和配置没有关系吗?

http://img.mukewang.com/szimg/5acdb32a0001ddbc08010211.jpg

写回答

2回答

风间影月

2018-04-11

他们是自己去竞争选举的,OK啦~

0
0

易水难求

2018-04-11

配置中的1,2,3只代表第一次的主从关系,之后的竞争和配置没有关系。

0
0

ZK分布式专题与Dubbo微服务入门,成长与加薪必备

进阶中高级工程师必备技能,大数据与微服务最常用的中间件

1859 学习 · 321 问题

查看课程