Zookeeper 在Windows下的安装与启动

一,官网下载Zookeeper 的gz包,选择自己所需版本

 

二,解压下载的gz包,推荐7-Zip解压,解压过程提示有文件重名,点击“自动重命名”即可。解压后如图:

1,参考官网指导进行相关配置,进入conf 目录,将zoo_sample.cfg复制一份,重命名为zoo.cfg

2,修改修改zoo.cfg配置文件,自定义dataDir和dataLogDir路径,建议新建在解压包下,方便统一管理,新建的data和logs文件夹与之一一对应。

 

3,启动,点击bin目录下的zkServer.cmd(相当于启动一个服务)

随后点击zkCli.cmd(相当于启动一个客户端)

zoo.cfg配置文件相关配置项注释:

# The number of milliseconds of each tick,客户端与服务器或者服务器与服务器之间维持心跳,
#也就是每个tickTime时间就会发送一次心跳。通过心跳不仅能够用来监听机器的工作状态,
#还可以通过心跳来控制Flower跟Leader的通信时间,默认情况下FL的会话时常是心跳间隔的两倍,默认200秒
tickTime=2000

# The number of ticks that the initial 
# synchronization phase can take
#集群中的follower服务器(F)与leader服务器(L)之间初始连接时能容忍的最多心跳数(tickTime的数量)
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.
# 该属性对应的目录是用来存放myid信息跟一些版本,日志,跟服务器唯一的ID信息等
dataDir=H:\software\apache-zookeeper-3.6.0-bin\apache-zookeeper-3.6.0-bin\data
dataLogDir=H:\software\apache-zookeeper-3.6.0-bin\apache-zookeeper-3.6.0-bin\logs

# 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

## Metrics Providers
#
# https://prometheus.io Metrics Exporter
#metricsProvider.className=org.apache.zookeeper.metrics.prometheus.PrometheusMetricsProvider
#metricsProvider.httpPort=7000
#metricsProvider.exportJvmInfo=true

数据创建可参考:Zookeeper客户端使用详解

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值