# The number of milliseconds of each tick # 时长单位为毫秒(默认2000ms),为zk使用的基本时间度量单位。 # 例如,1*tickTime是客户端与张昆服务端的心跳时间,2*tickTime是客户端会话的超时时间。 # 更低的tickTime可以更快的发现超时问题,但是也会导致更高的网络流量(心跳消息)和更高的cpu使用率(会话的跟踪处理)。 tickTime=2000 # The number of ticks that the initial initLimit*tickTime # synchronization phase can take # ZooKeeper集群模式下包含多个zk进程,其中一个进程为leader,余下的进程为follower。 # 当follower最初与leader建立连接时,它们之间会传输相当多的数据,尤其是follower的数据落后leader很多。 # initLimit配置follower与leader之间建立连接后进行同步的最长时间。 initLimit=10 # The number of ticks that can pass between syncLimit*tickTime # sending a request and getting an acknowledgement # 配置follower和leader之间发送消息,请求和应答的最大时间长度。 syncLimit=5 # the directory where the snapshot is stored. # do not use /tmp for storage, /tmp here is just # example sakes. # 无默认配置,必须配置,用于配置存储快照文件的目录。如果没有配置dataLogDir,那么事务日志也会存储在此目录。 # 集群模式下还有一个myid文件。myid文件的内容只有一行,且内容只能为1 - 255之间的数字, # 这个数字即是server.id中的id,表示zk进程的id。 dataDir=/tmp/zookeeper # the port at which the clients will connect # zk服务进程监听的TCP端口,默认情况下,服务端会监听2181端口 clientPort=2181 # 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 #其中id为一个数字,表示zk进程的id,这个id也是dataDir目录下myid文件的内容。 #host是该zk进程所在的IP地址,port1表示follower和leader交换消息所使用的端口,port2表示选举leader所使用的端口。 #server.id=host:port1:port2