ZooKeeper-配置 zoo.cfg

官方说明:https://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_configuration

# 通信心跳数,Zookeeper 服务器与客户端心跳时间,单位毫秒
# Zookeeper 使用的基本时间,服务器之间或客户端与服务器之间维持心跳的时间间隔,也就是每个 tickTime 时间就会发送一个心跳,时间单位为毫秒。
# 它用于心跳机制,并且设置最小的 session 超时时间为两倍心跳时间。(session 的最小超时时间是 2*tickTime)
tickTime=2000

# LF 初始通信时限
# 集群中的 Follower 跟随者服务器与 Leader 领导者服务器之间初始连接时能容忍的最多心跳数(tickTime 的数量),用它来限定集群中的 Zookeeper 服务器连接到 Leader 的时限。
initLimit=10

# LF 同步通信时限
# 集群中 Leader 与 Follower 之间的最大响应时间单位,假如响应超过 syncLimit * tickTime,Leader 认为 Follwer 死掉,从服务器列表中删除 Follwer。
syncLimit=5

# 数据文件目录+数据持久化路径,主要用于保存Zookeeper中的数据。
dataDir=/tmp/zookeeper

# 客户端连接端口,监听客户端连接的端口。
clientPort=2181

# 将事务日志写入 dataLogDir 而不是 dataDir
dataLogDir=/tmp/zookeeper/log
原文地址:https://www.cnblogs.com/jhxxb/p/10744790.html