ZooKeeper配置參數詳解

ZooKeeper的配置文件zoo.cfg內容如下:

# The number of milliseconds of each tick
tickTime=2000
# The number of ticks that the initial 
# synchronization phase can take
initLimit=10
# The number of ticks that can pass between 
# sending a request and getting an acknowledgement
syncLimit=5
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just 
# example sakes.
dataDir=D:\\zookeeper-3.4.14\\data
# 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
# Purge task interval in hours
# Set to "0" to disable auto purge feature
#autopurge.purgeInterval=1
  • tickTime=2000:通信心跳數,ZooKeeper服務器與客戶端心跳時間,ZooKeeper使用的基本時間,服務器之間或客戶端與服務器之間維持心跳的時間間隔,也就是每個tickTime時間就會發送一個心跳,時間單位爲毫秒。它用於心跳機制,並且設置最小的session超時時間爲兩倍心跳時間。(session的最小超時時間是2*tickTime)。
  • initLimit=10:Leader和Follower之間的初始通信時限,集羣中的Follower服務器與Leader服務器之間的初始連接時能容忍的最大心跳數(tickTime的數量),用它來限定集羣中的ZooKeeper服務器連接到Leader的時限。
  • syncLimit=5:Leader和Follower之間的同步通信時限,集羣中Leader與Follower之間的最大響應時間單位,如果響應時間超過syncLimit * tickTime,Leader認爲Follower掛掉,從服務器列表中刪除Follower。
  • dataDir=D:\\zookeeper-3.4.14\\data:數據文件目錄 + 數據持久化的路徑,主要用於保存ZooKeeper中的數據。默認是dataDir=/tmp/zookeeper
  • clientPort=2181:客戶端連接端口,監聽客戶端連接的端口。
  • 其他參數後續補充。。。
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章