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

相关推荐
斯普信专业组6 天前
Zookeeper添加SASL安全认证 修复方案
安全·zookeeper·debian
云游6 天前
利用外部Postgresql及zookeeper,启动Apache Dolphinscheduler3.1.9
分布式·postgresql·zookeeper·apache·工作流任务调度
jjkkzzzz7 天前
Linux下的C/C++开发之操作Zookeeper
linux·zookeeper·c/c++
Johny_Zhao8 天前
Docker + CentOS 部署 Zookeeper 集群 + Kubernetes Operator 自动化运维方案
linux·网络安全·docker·信息安全·zookeeper·kubernetes·云计算·系统运维
半新半旧9 天前
Redis集群和 zookeeper 实现分布式锁的优势和劣势
redis·分布式·zookeeper
Code季风10 天前
深入理解微服务中的服务注册与发现(Consul)
java·运维·微服务·zookeeper·架构·go·consul
武子康11 天前
大数据-31 ZooKeeper 内部原理 Leader选举 ZAB协议
大数据·后端·zookeeper
阿波罗.201211 天前
Zookeeper 客户端 .net访问框架 ZookeeperNetEx项目开发编译
分布式·zookeeper
武子康12 天前
大数据-30 ZooKeeper Java-API 监听节点 创建、删除节点
大数据·后端·zookeeper