1. 程式人生 > 其它 >Zookeeper配置檔案引數解讀

Zookeeper配置檔案引數解讀

技術標籤:zookeeperzookeeper

一、Zookeeper配置檔案

配置zoo_sample.cfg檔案路徑路徑(根據自己安裝的zookeeper位置目錄去看):/opt/module/apache-zookeeper-3.6.2-bin/conf

# 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=/opt/module/apache-zookeeper-3.6.2-bin/zkData
# 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

## Metrics Providers
#
# https://prometheus.io Metrics Exporter
#metricsProvider.className=org.apache.zookeeper.metrics.prometheus.PrometheusMetricsProvider
#metricsProvider.httpPort=7000
#metricsProvider.exportJvmInfo=true

二、配置引數解讀

1.tickTime =2000:通訊心跳數,Zookeeper 伺服器與客戶端心跳時間,單位毫秒
Zookeeper使用的基本時間,伺服器之間或客戶端與伺服器之間維持心跳的時間間隔, 也就是每個tickTime時間就會發送一個心跳,時間單位為毫秒。 它用於心跳機制,並且設定最小的session超時時間為兩倍心跳時間。(session的最小超 時時間是2*tickTime)。
2.initLimit =10:LF 初始通訊時限
叢集中的Follower跟隨者伺服器與Leader領導者伺服器之間初始連線時能容忍的最多心 跳數(tickTime的數量),用它來限定叢集中的Zookeeper伺服器連線到Leader的時限。
3.syncLimit =5:LF 同步通訊時限 叢集中Leader與Follower之間的最大響應時間單位,假如響應超過syncLimit * tickTime,Leader認為Follwer死掉,從伺服器列表中刪除Follwer。 4.dataDir:資料檔案目錄+資料持久化路徑
主要用於儲存 Zookeeper 中的資料。
5.clientPort =2181:客戶端連線埠
監聽客戶端連線的埠。