Windows 安装Zookeeper

安装

下载地址:Apache ZooKeeper

我下载的版本:zookeeper-3.4.12

下载后,解压

配置

1、 在D:\zookeeper-3.4.12文件夹中创建一个"data"文件夹和"log"文件夹

2、 复制zoo_sample.cfg,改名:zoo.cfg

修改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:\zookeeper-3.4.12\data
dataLogDir=D:\zookeeper-3.4.12\log
# the port at which the clients will connect
clientPort=2181
启动

进入目录:D:\zookeeper-3.4.12\bin

1、执行zkServer.cmd

2、执行zkCli.cmd

复制代码
#连接本地zk
zkCli.cmd

#链接远程zk
zkCli.cmd -server ip:port
简单用法

在zkCli.cmd上操作

  1. 创建节点

    create /test "my_data"

节点:/test

值:my_data

注意:在zk创建节点,必须要以"/"开头,否则会报错:Command failed: java.lang.IllegalArgumentException: Path must start with / character

  1. 获取节点

    get /test

  2. 修改节点

    set /test "abc"

  3. 创建子节点

    create /test/child "child"

  4. 查看子节点

    ls /test

  5. 删除节点

    delete /test/child

相关推荐
颯沓如流星12 小时前
ZKube:优雅易用的 ZooKeeper 可视化管理工具
分布式·zookeeper·云原生
霑潇雨5 天前
原生 Zookeeper 实现分布式锁案例
java·分布式·zookeeper·云原生·maven
薪火铺子6 天前
分布式锁深度实战:从 Redis 到 Zookeeper 深度解析
redis·分布式·zookeeper
hyunbar7 天前
ZooKeeper 未授权访问漏洞:你做的 ACL 加固可能只是“假动作”
分布式·zookeeper·云原生
hyunbar7778 天前
ZooKeeper 未授权访问漏洞:你做的 ACL 加固可能只是“假动作”
zookeeper
开开心心_Every9 天前
安卓免费证件照制作软件,无广告弹窗
linux·运维·服务器·安全·elasticsearch·zookeeper·pdf
深蓝轨迹9 天前
Kafka入门教程--帮你理清所有概念和细节
分布式·zookeeper·kafka
czlczl200209259 天前
Zookeeper
分布式·zookeeper·云原生
咸鱼2.013 天前
【java入门到放弃】Zookeeper
java·zookeeper
AIMath~13 天前
雪花算法+ZooKeeper解决方案+RPC是什么
分布式·zookeeper·云原生