首页  

zookeeper配置参数     所属分类 zookeeper 浏览量 101
# 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 for example
dataDir=/etc/zookeeper/data
dataLogDir=/etc/zookeeper/logs

# 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

# 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

minSessionTimeout=2
maxSessionTimeout=20


server.1=192.168.1.10:2888:3888
server.2=192.168.1.11:2888:3888
server.3=192.168.1.12:2888:3888
server.4=192.168.1.13:2888:3888:observer
server.5=192.168.1.14:2888:3888:observer


Leader
learner(follower,observer)
client

Leader     负责投票发起和决议,更新系统状态
follower   接收客户端请求并响应,选主过程参与投票
observer   不参加投票,只同步状态 。 提升读处理能力
client     请求发起方

集群 奇数台 , 超过半数集群可用 ,5个节点 ,允许挂2个节点

id配置
myid文件 
server.id=IP/Host:port1:port2
port1 Leader和Follower或Observer交换数据使用 ,leader才开启此端口
port2 用于Leader选举

minSessionTimeout  maxSessionTimeout
客户端连接 设置sessionTimeout , 
sessionTimeout 介于 minSessionTimeout 与 maxSessionTimeout 之间

  
autopurge配置
内存数据 snapshot ,快照数据不会自动删除 , 
快照文件和事务日志文件

autopurge.purgeInterval
单位小时 ,默认0 不自动清理

autopurge.snapRetainCount
保留快照文件和事务日志文件的个数,默认3


集群状态查看 
./zkServer.sh status
mode  
follower leader observer

观察者节点配置

配置
peerType=observer

其他节点增加配置
server.N=192.168.1.15:2888:3888:observer

上一篇     下一篇
zookeeper命令行zkCli使用

spring构造注入优缺点

springboot 构造注入实例

dubbo面试题

ZooKeeper面试题

springboot 读取中文配置乱码