zookeeper集群zoo.cfg配置文件详解

本文详细解析了ZooKeeper配置文件zoo.cfg的各项参数设置,包括心跳间隔、客户端连接超时、数据目录、日志位置、客户端端口、最大客户端连接数、快照保留策略及清除任务间隔等关键配置项。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

直接附上zoo.cfg文件内容:

# The number of milliseconds of each tick 心跳间隔2000ms
tickTime=2000
# The number of ticks that the initial 
# synchronization phase can take
# 初始化客户端连接时间,不能超过10*2000ms,超过时间客户端请求失败
initLimit=10
# The number of ticks that can pass between 
# sending a request and getting an acknowledgement
# leader与follower之间发送消息,请求和应答时间长度,
# 最长不能超过多少个tickTime的时间长度,总的时间长度就是5*2000=10秒。
syncLimit=5
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just 
# example sakes#数据和快照位置
dataDir=/home/zkdata

#日志位置
dataLogDir=/tmp/zklogs
# 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
#
# 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
# 保留3个快照数量
autopurge.snapRetainCount=3
# Purge task interval in hours
# Set to "0" to disable auto purge feature
#autopurge.purgeInterval=1
# 每3小时清除一次日志
autopurge.purgeInterval=3
#使用外网ip时本机zookeeper的ip地址应该配置成0.0.0.0:2888:3888
server.1=0.0.0.0:2888:3888
server.2=xxx.xxx.xxx.160:2888:3888
server.3=xxx.xxx.xxx.7:2888:3888
#观察者模式的节点如下
server.4=xxx.xxx.xxx.205:2888:3888:observer

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值