(六)zk配置文件介紹及運(yùn)行zk

一、zk配置文件 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=/Users/huluwa/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:用于計(jì)算的時(shí)間單元。比如session超時(shí):N*tickTime。
  • initLimit:用于集群的,允許節(jié)點(diǎn)連接并同步到master節(jié)點(diǎn)的初始化時(shí)間,以tickTime的倍數(shù)來(lái)表示。
  • syncLimit:用于集群,master主節(jié)點(diǎn)與 從節(jié)點(diǎn)之間發(fā)送消息,請(qǐng)求和 應(yīng)答的時(shí)間長(zhǎng)度。(心跳機(jī)制)
    如果從節(jié)點(diǎn)超過(guò)一定時(shí)間就會(huì)被拋棄。
  • dataDir:必須配置。zk的一些數(shù)據(jù),如日志啥的,都會(huì)存在此路徑下。
  • datalogDir:日志目錄,如果不配置會(huì)和dataDir公用。
  • clientPort:連接服務(wù)器的端口,默認(rèn)2181

現(xiàn)在的配置只是單機(jī)環(huán)境,后面集群環(huán)境再配置。

二、運(yùn)行zk

在安裝目錄的bin目錄下啟動(dòng)服務(wù)器:

./zkServer.sh start
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

友情鏈接更多精彩內(nèi)容