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

2. 获取节点

get /test

3. 修改节点

 set /test "abc"

4. 创建子节点

create /test/child "child"

5. 查看子节点

ls /test

6. 删除节点

delete /test/child

相关推荐

  1. Windows 安装Zookeeper

    2024-07-12 23:34:02       20 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-07-12 23:34:02       67 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-07-12 23:34:02       72 阅读
  3. 在Django里面运行非项目文件

    2024-07-12 23:34:02       58 阅读
  4. Python语言-面向对象

    2024-07-12 23:34:02       69 阅读

热门阅读

  1. 初学者必看的 3 个 Python 小项目

    2024-07-12 23:34:02       22 阅读
  2. 【Linux】docker和docker-compose 区别是什么

    2024-07-12 23:34:02       17 阅读
  3. EG800K GPS开发

    2024-07-12 23:34:02       20 阅读
  4. js之空值合并运算符 ‘??‘

    2024-07-12 23:34:02       23 阅读
  5. 代码优化方法记录

    2024-07-12 23:34:02       22 阅读
  6. 创建I/O文件fopen

    2024-07-12 23:34:02       15 阅读
  7. 学习大数据DAY15 PLSQL基础语法4

    2024-07-12 23:34:02       14 阅读
  8. 发改委对招标投标领域问题答复汇总

    2024-07-12 23:34:02       20 阅读