zookeeper实战一(下载、安装及简单使用)

本文详细介绍了如何从官方网站或百度云下载ZooKeeper,通过解压进行安装,并配置zoo.cfg文件。此外,还提供了启动服务端和客户端的步骤,以及如何执行基本操作,如查看节点、创建和修改znode等。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

一、下载

方式一:官网下载 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

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值