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=/home/myuser/zooA/data  

# the port at which the clients will connect  
clientPort=2181  

# ZooKeeper server and its port no. # ZooKeeper ensemble should know about every other machine in the ensemble # specify server id by creating 'myid' file in the dataDir # use hostname instead of IP address for convenient maintenance
server.1=127.0.0.1:2888:3888  
server.2=127.0.0.1:2988:3988   
server.3=127.0.0.1:2088:3088  

#  
# 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 dataLogDir=/home/myuser/zooA/log

  

 
tickTime:心跳時間,為了確保連接存在的,以毫秒為單位,最小超時時間為兩個心跳時間
initLimit:多少個心跳時間內,允許其他server連接並初始化數據,如果ZooKeeper管理的數據較大,則應相應增大這個值
clientPort:服務的監聽端口
dataDir:用於存放內存數據庫快照的文件夾,同時用於集群的myid文件也存在這個文件夾里(注意:一個配置文件只能包含一個dataDir字樣,即使它被注釋掉了。)
dataLogDir:用於單獨設置transaction log的目錄,transaction log分離可以避免和普通log還有快照的競爭
syncLimit:多少個tickTime內,允許follower同步,如果follower落后太多,則會被丟棄。
 
server.A=B:C:D:
A是一個數字,表示這個是第幾號服務器,B是這個服務器的ip地址
C第一個端口用來集群成員的信息交換,表示的是這個服務器與集群中的Leader服務器交換信息的端口
D是在leader掛掉時專門用來進行選舉leader所用


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM