# The number of milliseconds of each tick
tickTime=2000
# The number of ticks that the initial
# synchronization phase can take
# 配置zookeeper接受客户端(这里的客户端不是用户连接zookeeper服务器的客户端,而是zookeeper服务器集群中连接到leader的follow服务器)初始化连接时最长能忍受多少个心跳时间间隔数,当一家超过initLimit(默认为10)个心跳的时间(也就是tickTime)长度后zookeeper服务器还没有收到客户端的返回信息,那么表明这个客户端连接失败,总的时间长度就是5*2000=10秒
initLimit=10
# The number of ticks that can pass between
# sending a request and getting an acknowledgement
#配置leader与follower之间发生消息,请求和应答时间长度,最长不超过多少个tickTime的时间长度,总的时间长度就是2*2000=4秒
syncLimit=2
# the directory where the snapshot is stored.
dataDir=D:\\zookeeper-3.3.6\\data
dataLogDir=D:\\zookeeper-3.3.6\\log
# the port at which the clients will connect
#zookeeper三种端口号
#2181 客户端连接zookeeper集群使用的监听端口号
#3888 选举leader使用
#2888 集群内机器通讯使用(leader和follower直接数据同步使用的端口号,leader监听此端口)
clientPort=2181
#限制连接到zookeeper的客户端数量
maxClientCnxns=60
#server.A=B:C:D;其中A是一个数字,表示这个是第几号服务器。B是这个服务器的IP地址。C表示这个服务器与集群的leader服务器交换信息的端口(2888);D表示的是万一集群中的leader服务器挂了,需要一个端口来重新进行选举,选出一个新的leader,而这个端口就是用来执行选举时服务器相互通信的端口(3888)。如果是伪集群的配置丰富,由于B都是一样的,所以不同的zookeeper实例通信端口号不能一样,所以要给他们分配不同的端口号
#注意server.A中的A是在dataDir配置的目录中创建一个名为myid的文件里的值
server.1=127.0.0.1:2888:3888
server.2=127.0.0.1:2887:3887
server.3=127.0.0.1:2889:3889
window伪集群的时候要把zookeeper复制三份,每一份data/myid分别对应的1 2 3,记得myid后缀要去掉;同时server.A=B:C:D中C和D要不一样,正式集群的时候只有B不一样