zookeeper (二) 集群安装
1.集群安装
1.1 配置文件解读
# The number of milliseconds of each tick
## 心跳 维护节点存活状态
tickTime=2000
# The number of ticks that the initial
# synchronization phase can take
## follower 连接 leader 允许几次不成功 允许时间 tickTime * initLimit = 20000ms
initLimit=10
# The number of ticks that can pass between
# sending a request and getting an acknowledgement
## follower 连接 leader 同步数据允许几次不成功 允许时间 tickTime * syncLimit = 10000ms
syncLimit=5
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just
# example sakes.
## 数据存储目录 不用 /tmp 作为路径
dataDir=/package/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
# 集群配置 节点数量/2 就是过半数量 3888 socket 选择leader ,leader 开启2888 开始数据同步
# 投票的时候选择节点是通过id ,id 大的就是leader
# ### HOSTNAME:port:port
server.1=CentOSA:2888:3888
server.2=CentOSB:2888:3888
server.3=CentOSC:2888:3888
server.3=CentOSD:2888:3888
配置文件中 dataDir=/package/zkdata
添加一个文件myid
里面写 配置文件里面的service.[number]
比如说第一台: CentOSA:2888:3888
文件myid
内容就是 1
;
注:防火墙对应的端口需要打开
[root@CentOSA zkdata]# pwd
/package/zkdata
[root@CentOSA zkdata]# cat myid
1