ZooKeeper的zoo.cfg参数分析
# The number of milliseconds of each tick
#基础时间单元
tickTime=2000
# The number of ticks that the initial
# synchronization phase can take
#Follower同步Leader的限制时间,initLimit * tickTime,随ZK集群数据量适当增加值
initLimit=10
# The number of ticks that can pass between
# sending a request and getting an acknowledgement
#L发送心跳包到收到F响应的限制时间,syncLimit * tickTime,不适合太大,容易使L误认为F在线
syncLimit=5
# the directory where the snapshot is stored.
#dataDir存储快照snapshot目录。
#dataLogDir事务日志输出目录,建议单独一个磁盘或挂载点,可极大的提升ZK性能
dataDir=/opt/zookeeper/data
dataLogDir=/opt/zookeeper/log
# the port at which the clients will connect
#server端口
clientPort=2181
#server.X=A:B:C # 其中X是一个数字, 表示这是第几号server. A是该server所在的IP地址. B配置该server和集群中的leader交换消息所使用的端口. C配置选举leader时所使用的端口. 这里的x是一个数字,与myid文件中的id是一致的。
server.1=sitapp01:2888:3888
#server.2=sitapp02:2888:3888
# the maximum number of client connections.
#单个客户端与单台服务器之间的连接数的限制,默认是60,如果设置为0,那么表明不作任何限制。
maxClientCnxns=100
# Session超时时间限制,如果客户端设置的超时时间不在这个范围,那么会被强制设置为最大或最小时间。默认的Session超时时间是在2 * tickTime ~ 20 * tickTime 这个范围 。
minSessionTimeout=4000
maxSessionTimeout=40000
# Purge task interval in hours
# Set to "0" to disable auto purge feature
# 3.4.0及之后版本,ZK提供了自动清理事务日志和快照文件的功能,这个参数指定了清理频率,单位是小时,需要配置一个1或更大的整数,默认是0,表不开启自动清理功能
autopurge.purgeInterval=1
# The number of snapshots to retain in dataDir
# 这个参数和上面的参数搭配使用,这个参数指定了需要保留的文件数目。默认是保留3个。
autopurge.snapRetainCount=3