ZK安装、ZK配置、ZK集群部署

#间隔都是使用tickTime的倍数来表示的,例如initLimit=10就是tickTime的十倍等于2W毫秒
tickTime=2000

# The number of ticks that can pass between, sending a request and getting an acknowledgement
# 心跳最大延迟时间,如果leader在规定的时间内无法获取到follow的心跳检测响应,则认为节点已脱离
syncLimit=5

# the directory where the snapshot is stored. do not use /tmp for storage, /tmp here is just. example sakes.
# 用于存放内存数据库快照的文件夹,同时用于集群的myid文件也存在这个文件夹里
dataDir=G:\\program-my\\zookeeper-3.4.9\\data

# the port at which the clients will connect,ZK端口
clientPort=2181

# the maximum number of client connections. increase this if you need to handle more clients
# 允许连接的客户端数目,0-不限制,通过 IP 来区分不同的客户端
maxClientCnxns=60

#将管理机器把事务日志写入到“ dataLogDir ”所指定的目录,而不是“ dataDir ”所指定的目录。避免日志和快照之间的竞争
#dataLogDir=/root/Hadoop-0.20.2/zookeeper-3.3.1/log/data_log

# The number of snapshots to retain in dataDir
#用于配置zookeeper在自动清理的时候需要保留的快照数据文件数量和对应的事务日志文件,最小值时三,如果比3小,会自动调整为3
#autopurge.snapRetainCount=3

# Purge task interval in hours. Set to "0" to disable auto purge feature
#配套snapRetainCount使用,用于配置zk进行历史文件自动清理的频率,如果参数配置为0或者小于零,就表示不开启定时清理功能,默认不开启
#autopurge.purgeInterval=1


##集群配置
# The number of ticks that the initial, synchronization phase can take
# follow服务器在启动的过程中会与leader服务器建立链接并完成对数据的同步,leader服务器允许follow在initLimit时间内完成,默认时10.集群量增大时
#同步时间变长,有必要适当的调大这个参数, 当超过设置倍数的 tickTime 时间,则连接失败
initLimit=10

#server.A=B:C:D:其中 A 数字,表示是第几号服务器. dataDir目录下必有一个myid文件,里面只存储A的值,ZK启动时读取此文件,与下面列表比较判断是哪个server
# B 是服务器 ip ;C表示与 Leader 服务器交换信息的端口;D 表示的是进行选举时的通信端口。
server.1=127.0.0.1:2888:3888
server.2=127.0.0.1:2889:3889
server.3=127.0.0.1:2890:3890

# 配置成observer模式
peerType=observer
# 注意观察者角色的末尾,需要拼接上observer 
server.4=10.2.143.38:2886:3886:observer

猜你喜欢

转载自www.cnblogs.com/niunafei/p/11294240.html
zk