一、下载
方式一:官网下载 https://www.apache.org/dyn/closer.cgi/zookeeper/
方式二:百度云 链接:https://pan.baidu.com/s/1HrFakvjKkgVHfvnsF2S15A 密码:ole4
二、安装(解压即安装)
文件目录如下
注意:解压后conf目录结构如下
需要增加zoo.cfg文件(复制zoo_sample.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=F:\\zookeeper-3.4.10\\data
#日志目录
dataLogDir=F:\\zookeeper-3.4.10\\log
# 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
三、使用
1.在bin目录下的地址栏执行cmd进入如下界面
2.执行zkServer.cmd启动zk服务端
3.启动后如下图
4.再启动一个黑窗口,执行zkCli.cmd,启动zk客户端
5.查看根目录下有哪些节点
6.创建znode
7.获取znode数据
8.修改/zhang节点数据
9.再次获取/zhang节点的数据,数据已更改为222
10.删除znode