Zookeeper安装
一、下载
在Zookeeper官网下载所需版本,我这里下载的是3.7.0
二、安装
2.1在Zookeeper解压目录中创建data和logs文件夹
2.2进入conf文件夹,复制zoo_sample.cfg文件并重命名为zoo.cfg,放在conf文件夹下
2.3打开zoo.cfg,并添加如下路径
dataDir=D:\software\Zookeeper\apache-zookeeper-3.7.0-bin\data
dataLogDir=D:\software\Zookeeper\apache-zookeeper-3.7.0-bin\logs
如图:
2.4测试
打开bin
文件夹下的zkServer.cmd
打开bin
文件夹下zkCli.cmd
出现如上信息,表示安装成功。
三、配置文件相关配置项注释
3.1 zoo.cfg配置文件相关配置项注释:
# The number of milliseconds of each tick
# 心跳的时间间隔
tickTime=2000
# The number of ticks that the initial
# synchronization phase can take
# Follower 服务器初始化连接时最长能忍受多少个心跳时间间隔数
initLimit=10
# The number of ticks that can pass between
# sending a request and getting an acknowledgement
#集群中flower服务器(F)跟leader(L)服务器之间的请求和答应最多能容忍的心跳数
syncLimit=5
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just
# example sakes.
dataDir=/tmp/zookeeper
# the port at which the clients will connect
# 客户端连接的接口,客户端连接zookeeper服务器的端口,zookeeper会监听这个端口,接收客户端的请求访问!这个端口默认是2181
clientPort=2181
# the maximum number of client connections.
# increase this if you need to handle more clients
# 客户端的最大连接数量,默认60个
#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
dataDir=D:\software\Zookeeper\apache-zookeeper-3.7.0-bin\data
dataLogDir=D:\software\Zookeeper\apache-zookeeper-3.7.0-bin\logs
## Metrics Providers
#
# https://prometheus.io Metrics Exporter
#metricsProvider.className=org.apache.zookeeper.metrics.prometheus.PrometheusMetricsProvider
#metricsProvider.httpPort=7000
#metricsProvider.exportJvmInfo=true