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

相关推荐
灰色孤星A4 天前
Kafka学习笔记(三)Kafka分区和副本机制、自定义分区、消费者指定分区
zookeeper·kafka·kafka分区机制·kafka副本机制·kafka自定义分区
漫无目的行走的月亮6 天前
Ubuntu下安装Zookeeper集群
linux·ubuntu·zookeeper
程序那点事儿7 天前
zookeeper 服务搭建(集群)
linux·分布式·zookeeper
楼下创了电瓶车8 天前
ubuntu20.04系统安装zookeeper简单教程
分布式·zookeeper·云原生
AAA 建材批发王哥(天道酬勤)8 天前
ZooKeeper
java·zookeeper
lzhlizihang8 天前
Hadoop集群的高可用(HA):NameNode和resourcemanager高可用的搭建
hadoop·zookeeper·高可用·ha
懒鸟一枚9 天前
Zookeeper下载、安装配置
分布式·zookeeper
程序那点事儿10 天前
zookeeper 服务搭建(单机)
分布式·zookeeper·云原生·java-zookeeper
花千树-01011 天前
深度对比:etcd、Consul、Zookeeper 和 Nacos 作为注册中心和配置中心的优势与劣势
微服务·zookeeper·服务发现·etcd·consul
花千树-01011 天前
Dubbo 如何使用 Zookeeper 作为注册中心:原理、优势与实现详解
分布式·zookeeper·dubbo