Zookeeper(一)------windows单机部署Zookeeper

一、ZooKeeper的下载

下载地址:http://www.apache.org/dyn/closer.cgi/zookeeper/

https://download.csdn.net/download/qq_29914837/11961294

在这里插入图片描述
目前文档版本是3.5.6

二、ZooKeeper的配置

在这里插入图片描述

Zookeeper 的配置文件在 conf 目录下,这个目录下有 zoo_sample.cfg 和 log4j.properties.

将 zoo_sample.cfg 改名为 zoo.cfg,因为 Zookeeper 在启动时会找这个文件作为默认配置文件。

下面详细介绍 zoo.cfg这个配置文件中各个配置项的意义

# 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 
# example sakes.
#dataDir=/tmp/zookeeper
dataDir=D:\\Program Files\\work\\apache-zookeeper-3.5.6-bin\\tmp
# 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

一、tickTime:作为 Zookeeper 服务器之间或客户端与服务器之间维持心跳的时间间隔,也就是每个 tickTime 时间就会发送一个心跳。
二、dataDir:Zookeeper 保存数据的目录,默认情况下,Zookeeper 将写数据的日志文件也保存在这个目录里。
三、dataLogDir:Zookeeper 保存日志文件的目录
四、clientPort:这个端口就是客户端连接 Zookeeper 服务器的端口,Zookeeper 会监听这个端口,接受客户端的访问请求。

三、ZooKeeper的启动

Zookeeper 的启动脚本在 bin 目录下,进入bin目录双击zkServer.cmd

zkServer.cmd 可以在结尾处添加pause,防止启动闪退,可以查看错误信息。

在这里插入图片描述
在这里插入图片描述
输入JPS,出现如下,也说明启动成功
在这里插入图片描述

启动之后一直开着,不要关掉这个cmd,记得要在Dubbo消费者和提供者运行之前就开启Zookeeper。


如果你觉得本篇文章对你有所帮助的话,麻烦请点击头像右边的关注按钮,谢谢!

技术在交流中进步,知识在分享中传播

发布了166 篇原创文章 · 获赞 212 · 访问量 19万+

猜你喜欢

转载自blog.csdn.net/qq_29914837/article/details/102907864