1. 程式人生 > >zookeeper叢集zoo.cfg配置檔案詳解

zookeeper叢集zoo.cfg配置檔案詳解

直接附上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
#重點本機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