# The number of milliseconds of each tick # 基本事件单元,这个时间是作为Zookeeper服务器之间或客户端与服务器之间维持心跳的时间间隔,# 每隔tickTime时间就会发送一个心跳;最小 的session过期时间为2倍tickTime
tickTime=2000# The number of ticks that the initial # synchronization phase can take# 此配置表示,允许follower(相对于Leaderer言的“客户端”)连接并同步到Leader的初始化连接时间,以tickTime为单位。当初始化连接时间超过该值,则表示连接失败。
initLimit=10# The number of ticks that can pass between # sending a request and getting an acknowledgement# 此配置项表示Leader与Follower之间发送消息时,请求和应答时间长度。如果follower在设置时间内不能与leader通信,那么此follower将会被丢弃。
syncLimit=5# the directory where the snapshot is stored. # do not use /tmp for storage, /tmp here is just # example sakes.# dataDir=/tmp/zookeeper# 存储内存中数据库快照的位置,如果不设置参数,更新食物的日志将被存储到默认位置。
dataDir=/public/software/Zookeeper/workspace/data
# 这个操作让管理机器把事务日志写入“dataLogDir”所指定的目录中,而不是“dataDir”所指定的目录。这将允许使用一个专用的日志设备,帮助我们避免日志和快照的竞争。# 日志目录# 应该谨慎的选择日志存放的位置,使用专用的日志存储设备能够大大提高系统的性能,如果将日志存储在比较繁忙的存储设备上,那么将会很大程度上影像系统性能。
dataLogDir=/public/software/Zookeeper/workspace/log
server.1=192.168.60.150:2888:3888
server.2=192.168.60.151:2888:3888
server.3=192.168.60.152:2888:3888# server.A=B:C:D:其中 A 是一个数字,表示这个是第几号服务器;# B 是这个服务器的 ip 地址;# C 表示的是这个服务器与集群中的 Leader 服务器交换信息的端口;# D 表示的是万一集群中的 Leader 服务器挂了,需要一个端口来重新进行选举,选出一个新的 Leader,# 而这个端口就是用来执行选举时服务器相互通信的端口。如果是伪集群的配置方式,# 由于 B 都是一样,所以不同的 Zookeeper 实例通信端口号不能一样,所以要给它们分配不同的端口号。# the port at which the clients will connect # 监听客户端连接的端口。
clientPort=2181# the maximum number of client connections.# increase this if you need to handle more clients #maxClientCnxns=60# 下面是对maxClientCnxns的解释# 这个操作将限制连接到Zookeeper的客户端数量,并限制并发连接的数量,通过IP来区分不同的客户端。此配置选项可以阻止某些类别的Dos攻击。将他设置为零或忽略不进行设置将会取消对并发连接的限制。#例如,此时我们将maxClientCnxns的值设为1,如下所示:# set maxClientCnxns# maxClientCnxns=1#启动Zookeeper之后,首先用一个客户端连接到Zookeeper服务器上。之后如果有第二个客户端尝试对Zookeeper进行连接,或者有某些隐式的对客户端的连接操作,将会触发Zookeeper的上述配置。#minSessionTimeout和maxSessionTimeout#即最小的会话超时和最大的会话超时时间。在默认情况下,minSession=2*tickTime;maxSession=20*tickTime。## 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