zookeeper configuration analysis (collection)

The default configuration file of zookeeper is zookeeper/conf/zoo_sample.cfg, which needs to be modified to zoo.cfg. The meaning of each configuration item is explained as follows:

 

1.tickTime: CS communication heartbeat number

The interval for maintaining heartbeats between Zookeeper servers or between clients and servers, that is, a heartbeat is sent every tickTime. tickTime is in milliseconds.

  1. tickTime=2000  


2. initLimit: LF initial communication time limit
The maximum number of heartbeats (the number of tickTimes) that can be tolerated during the initial connection between the follower server (F) and the leader server (L) in the LF cluster.

  1. initLimit = 5  


3.syncLimit:
The maximum number of heartbeats (the number of tickTimes) that can be tolerated between the request and response between the follower server and the leader server in the LF synchronous communication time limit.

  1. syncLimit=2  

 
4. dataDir: The data file directory
Zookeeper saves the data directory. By default, Zookeeper also saves the log files for writing data in this directory.

  1. dataDir=/home/michael/opt/zookeeper/data  


5.dataLogDir: log file directory
Zookeeper saves the log file directory.

  1. dataLogDir=/home/michael/opt/zookeeper/log  


6. clientPort: client connection port
The port where the client connects to the Zookeeper server. Zookeeper will listen to this port and accept the client's access request.

  1. clientPort=2333  


7. Server name and address: Cluster information (server number, server address, LF communication port, election port)
is written in a special format. The rules are as follows:

  1. server.N=YYY:A:B  


其中N表示服务器编号,YYY表示服务器的IP地址,A为LF通信端口,表示该服务器与集群中的leader交换的信息的端口。B为选举端口,表示选举新leader时服务器间相互通信的端口(当leader挂掉时,其余服务器会相互通信,选择出新的leader)。一般来说,集群中每个服务器的A端口都是一样,每个服务器的B端口也是一样。但是当所采用的为伪集群时,IP地址都一样,只能时A端口和B端口不一样。
下面是一个非伪集群的例子:

  1. server.0=233.34.9.144:2008:6008  
  2. server.1=233.34.9.145:2008:6008  
  3. server.2=233.34.9.146:2008:6008  
  4. server.3=233.34.9.147:2008:6008  


下面是一个伪集群的例子:

  1. server.0=127.0.0.1:2008:6008  
  2. server.1=127.0.0.1:2007:6007  
  3. server.2=127.0.0.1:2006:6006  
  4. server.3=127.0.0.1:2005:6005  

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326674429&siteId=291194637