分布式中提供者实现轮询--zookeeper集群

2018-09-24  本文已影响0人  09c72470861c

在消费者端调用提供者时,为了减轻服务器压力,就要配多个提供者,这时就要将zookeeper集群,因为项目第一期中准备部署3个消费者,所以本次测试使用了3个zookeeper。

  • 本次测试只关心集群的配置,所以略过了dataLogDir的配置,只配置了dataDir
  • zookeeper可以到apache官网下载,我也分享了一个在网盘中:
    zookeeper版本3.4.13,密码5pxl

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=F:\\bfy-test\\zookeeper\\zookeeper-1\\data
# the port at which the clients will connect
clientPort=2181

#zookeeper机器列表,server.order这里的Order依据集群的机器个数依次进行递增,这里的server1、server2、server3表示机器IP地址
server.1=127.0.0.1:2881:3881
server.2=127.0.0.1:2882:3882
server.3=127.0.0.1:2883:3883

#发送心跳的间隔时间,单位:毫秒
tickTime=2000
#leader和follower初始化连接时最长能忍受多少个心跳时间的间隔数
initLimit=5
#leader和follower之间发送消息,请求和英达时间长度,最长不能超过多少个tickTime的时间长度
syncLimit=2


# 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

上一篇 下一篇

猜你喜欢

热点阅读