【Zookeeper windows 环境安装】
时间:2023-06-17 01:37:00
Zookeeper windows 环境安装
环境要求
必须要有 jdk 环境 , 我使用jdk1.8
安装 jdk
略
下载 Zookeeper
在官网 http://zookeeper.apache.org/ 下载 zookeeper. 我下载的是zookeeper-3.7.0 版本
https://zookeeper.apache.org/releases.html
解压到目录
解压 zookeeper-3.7.0 至 D:\zookeeper-3.7.0
Zookeeper安装
ZooKeeper 分为三种安装方式:单机模式(stand-alone)、集群模式和集群伪分布模式。ZooKeeper 如果第一次接触,单机模式的安装相对简单 ZooKeeper 的话, 建议安装 ZooKeeper 单机模式或集群伪分布模式。
安装单击模式
配置cfg文件
D:\zookeeper-3.7.0\conf 复制 zoo_sample.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=D:/zookeeper-3.7.0-bin/simpleData # 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 ## Metrics Providers # # https://prometheus.io Metrics Exporter #metricsProvider.className=org.apache.zookeeper.metrics.prometheus.PrometheusMetricsProvider #metricsProvider.httpPort=7000 #metricsProvider.exportJvmInfo=true
修改data目录
dataDir=D:/zookeeper-3.7.0-bin/simpleData
启动
为了方便看日志,使用cmd启动
D:\zookeeper-3.7.0\bin>call "D:\Program Files\Java\jdk1.8.0_211"\bin\java "-Dzookeeper.log.dir=D:\zookeeper-3.7.0\bin\..\logs" "-Dzookeeper.root.logger=INFO,CONSOLE" "-Dzookeeper.log.file=zookeeper-hgy-server-HGY.log" "-XX: HeapDumpOnOutOfMemoryError" "-XX:OnOutOfMemoryError=cmd /c taskkill /pid %%p /t /f" -cp "D:\zookeeper-3.7.0\bin\..\build\classes;D:\zookeeper-3.7.0\bin\..\build\lib\*;D:\zookeeper-3.7.0\bin\..\*;D:\zookeeper-3.7.0\bin\..\lib\*;D:\zookeeper-3.7.0\bin\..\conf" org.apache.zookeeper.server.quorum.QuorumPeerMain "D:\zookeeper-3.7.0\bin\..\conf\zoo.cfg" start ../conf/zoo.cfg 2021-12-20 22:26:16,703 [myid:] - INFO [main:DatadirCleanupManager@78] - autopurge.snapRetainCount set to 3 2021-12-20 22:26:16,706 [myid:] - INFO [main:DatadirCleanupManager@79] - autopurge.purgeInterval set to 0 2021-12-20 22:26:16,706 [myid:] - INFO [main:DatadirCleanupManager@101] - Purge task is not scheduled. 2021-12-20 22:26:16,706 [myid:] - WARN [main:QuorumPeerMain@139] - Either no config or no quorum defined in config, running in standalone mode 2021-12-20 22:26:16,709 [myid:] - INFO [main:ManagedUtil@44] - Log4j 1.2 jmx support found and enabled. 2021-12-20 22:26:16,760 [myid:] - ERROR [main:ZooKeeperServerMain@70] - Invalid arguments, exiting abnormally java.lang.NumberFormatException: For input string: "D:\zookeeper-3.7.0\bin\..\conf\zoo.cfg" at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) at java.lang.Integer.parseInt(Integer.java:580) at java.lang.Integer.parseInt(Integer.java:615) at org.apache.zookeeper.server.ServerConfig.parse(ServerConfig.java:78) at org.apache.zookeeper.server.ZooKeeperServerMain.initializeAndRun(ZooKeeperServerMain.java:110) at org.apache.zookeeper.server.ZooKeeperServerMain.main(ZooKeeperServerMain.java:68) at org.apache.zookeeper.server.quorum.QuorumPeerMain.initializeAndRun(QuorumPeerMain.java:141) at org.apache.zookeeper.server.quorum.QuorumPeerMain.main(QuorumPeerMain.java:91) 2021-12-20 22:26:16,761 [myid:] - INFO [main:ZooKeeperServerMain@71] - Usage: ZooKeeperServerMain configfile | port datadir [ticktime] [maxcnxns] Usage: ZooKeeperServerMain configfile | port datadir [ticktime] [maxcnxns] 2021-12-20 22:26:16,763 [myid:] - INFO [main:ZKAuditProvide@42] - ZooKeeper audit is disabled.
2021-12-20 22:26:16,796 [myid:] - ERROR [main:ServiceUtils@42] - Exiting JVM with code 2
报错了,为什么呢? 百度无果,可能是因为我作死使用的最新版本
看启动文件
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-NyIAfuiI-1640096713879)(img/zookeeper%E7%9A%84%E9%83%A8%E7%BD%B2/image-20211220224539648.png)]
@echo off
REM Licensed to the Apache Software Foundation (ASF) under one or more
REM contributor license agreements. See the NOTICE file distributed with
REM this work for additional information regarding copyright ownership.
REM The ASF licenses this file to You under the Apache License, Version 2.0
REM (the "License"); you may not use this file except in compliance with
REM the License. You may obtain a copy of the License at
REM
REM http://www.apache.org/licenses/LICENSE-2.0
REM
REM Unless required by applicable law or agreed to in writing, software
REM distributed under the License is distributed on an "AS IS" BASIS,
REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
REM See the License for the specific language governing permissions and
REM limitations under the License.
setlocal
call "%~dp0zkEnv.cmd"
set ZOOMAIN=org.apache.zookeeper.server.quorum.QuorumPeerMain
set ZOO_LOG_FILE=zookeeper-%USERNAME%-server-%COMPUTERNAME%.log
echo on
call %JAVA% "-Dzookeeper.log.dir=%ZOO_LOG_DIR%" "-Dzookeeper.root.logger=%ZOO_LOG4J_PROP%" "-Dzookeeper.log.file=%ZOO_LOG_FILE%" "-XX:+HeapDumpOnOutOfMemoryError" "-XX:OnOutOfMemoryError=cmd /c taskkill /pid %%%%p /t /f" -cp "%CLASSPATH%" %ZOOMAIN% "%ZOOCFG%" %*
endlocal
进行了两次调用, call
- call “%~dp0zkEnv.cmd”
- call %JAVA% “-Dzookeeper.log.dir=%ZOO_LOG_DIR%” “-Dzookeeper.root.logger=%ZOO_LOG4J_PROP%” “-Dzookeeper.log.file=%ZOO_LOG_FILE%” “-XX:+HeapDumpOnOutOfMemoryError” “-XX:OnOutOfMemoryError=cmd /c taskkill /pid %%%%p /t /f” -cp “%CLASSPATH%” %ZOOMAIN% “%ZOOCFG%” %*
先看call “%~dp0zkEnv.cmd”
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-2eyEQQOZ-1640096713879)(img/zookeeper%E7%9A%84%E9%83%A8%E7%BD%B2/image-20211220224717368.png)]
REM 的注释我全部删除了
@echo off
set ZOOCFGDIR=%~dp0%..\conf
set ZOO_LOG_DIR=%~dp0%..\logs
set ZOO_LOG4J_PROP=INFO,CONSOLE
set CLASSPATH=%ZOOCFGDIR%
SET CLASSPATH=%~dp0..\*;%~dp0..\lib\*;%CLASSPATH%
SET CLASSPATH=%~dp0..\build\classes;%~dp0..\build\lib\*;%CLASSPATH%
set ZOOCFG=%ZOOCFGDIR%\zoo.cfg
if not defined JAVA_HOME (
echo Error: JAVA_HOME is not set.
goto :eof
)
set JAVA_HOME=%JAVA_HOME:"=%
if not exist "%JAVA_HOME%"\bin\java.exe (
echo Error: JAVA_HOME is incorrectly set: %JAVA_HOME%
echo Expected to find java.exe here: %JAVA_HOME%\bin\java.exe
goto :eof
)
if "%JAVA_HOME:~-1%" EQU "\" set "JAVA_HOME=%JAVA_HOME:~0,-1%"
set JAVA="%JAVA_HOME%"\bin\java
看到了这个,说明我们的代码好像是不需要参数的
set ZOOCFGDIR=%~dp0%…\conf
%~dp0?
Windows脚本 - %~dp0的含义
更改当前目录为批处理本身的目录
有些晕吧?不急,我举例
比如你有个批处理a.bat在D:\qq文件夹下
a.bat内容为
cd /d %~dp0
在这里
cd /d %~dp0的意思就是cd /d d:\qq
%0代表批处理本身 d:\qq\a.bat
~dp是变量扩充
d既是扩充到分区号 d:
p就是扩充到路径 \qq
dp就是扩充到分区号路径 d:\qq参考: https://www.cnblogs.com/smwikpedia/archive/2009/03/30/1424749.html
直接使用zkServer.cmd启动果然成功了
D:\zookeeper-3.7.0\bin>zkServer.cmd
D:\zookeeper-3.7.0\bin>call "D:\Program Files\Java\jdk1.8.0_211"\bin\java "-Dzookeeper.log.dir=D:\zookeeper-3.7.0\bin\..\logs" "-Dzookeeper.root.logger=INFO,CONSOLE" "-Dzookeeper.log.file=zookeeper-hgy-server-HGY.log" "-XX:+HeapDumpOnOutOfMemoryError" "-XX:OnOutOfMemoryError=cmd /c taskkill /pid %%p /t /f" -cp "D:\zookeeper-3.7.0\bin\..\build\classes;D:\zookeeper-3.7.0\bin\..\build\lib\*;D:\zookeeper-3.7.0\bin\..\*;D:\zookeeper-3.7.0\bin\..\lib\*;D:\zookeeper-3.7.0\bin\..\conf" org.apache.zookeeper.server.quorum.QuorumPeerMain "D:\zookeeper-3.7.0\bin\..\conf\zoo.cfg"
2021-12-20 22:44:30,355 [myid:] - INFO [main:QuorumPeerConfig@174] - Reading configuration from: D:\zookeeper-3.7.0\bin\..\conf\zoo.cfg
______ _
|___ / | |
/ / ___ ___ | | __ ___ ___ _ __ ___ _ __
/ / / _ \ / _ \ | |/ / / _ \ / _ \ | '_ \ / _ \ | '__|
/ /__ | (_) | | (_) | | < | __/ | __/ | |_) | | __/ | |
/_____| \___/ \___/ |_|\_\ \___| \___| | .__/ \___| |_|
| |
|_|
数据目录变化
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-PgRcYT4O-1640096713880)(img/zookeeper%E7%9A%84%E9%83%A8%E7%BD%B2/image-20211220225312783.png)]
客户端连接
测试单机
D:\zookeeper-3.7.0\bin>zkCli.cmd -server 127.0.0.1:2181
Connecting to 127.0.0.1:2181
2021-12-21 20:18:17,307 [myid:127.0.0.1:2181] - INFO [main-SendThread(127.0.0.1:2181):ClientCnxn$SendThread@1005] - Socket connection established, initiating session, client: /127.0.0.1:59087, server: 127.0.0.1/127.0.0.1:2181
JLine support is enabled
[zk: 127.0.0.1:2181(CONNECTING) 0]
集群伪分布模式
伪集群就是说集群所有的机器都在一台机器上,但是还是以集群的特性对外提供服务。这种模式和集群模式非常类似,只是把 zoo.cfg 做一些修改:
zoo.cfg配置
分别创建不同的数据目录
D:/zookeeper-3.7.0/zk/data/1
D:/zookeeper-3.7.0/zk/data/2
D:/zookeeper-3.7.0/zk/data/3
创建目录如下
D:/zookeeper-3.7.0/
conf1/zoo.cfg
conf2/zoo.cfg
conf3/zoo.cfg
windows cmd运行不需要参数,如果添加了参数就会报如下需错误
zookeeper-hgy-server-HGY.log" "-XX:+HeapDumpOnOutOfMemoryError" "-XX:OnOutOfMemoryError=cmd /c taskkill /pid %%p /t /f" -cp "D:\zookeeper-3.7.0\bin\..\build\classes;D:\zookeeper-3.7.0\bin\..\build\lib\*;D:\zookeeper-3.7.0\bin\..\*;D:\zookeeper-3.7.0\bin\..\lib\*;D:\zookeeper-3.7.0\bin\..\conf" org.apache.zookeeper.server.quorum.QuorumPeerMain "D:\zookeeper-3.7.0\bin\..\conf\zoo.cfg" D:/zookeeper-3.7.0/conf/zoo1.cfg
2021-12-21 21:01:34,219 [myid:] - INFO [main:DatadirCleanupManager@78] - autopurge.snapRetainCount set to 3
2021-12-21 21:01:34,221 [myid:] - INFO [main:DatadirCleanupManager@79] - autopurge.purgeInterval set to 0
2021-12-21 21:01:34,225 [myid:] - INFO [main:DatadirCleanupManager@101] - Purge task is not scheduled.
2021-12-21 21:01:34,225 [myid:] - WARN [main:QuorumPeerMain@139] - Either no config or no quorum defined in config, running in standalone mode
2021-12-21 21:01:34,232 [myid:] - INFO [main:ManagedUtil@44] - Log4j 1.2 jmx support found and enabled.
2021-12-21 21:01:34,285 [myid:] - ERROR [main:ZooKeeperServerMain@70] - Invalid arguments, exiting abnormally
java.lang.NumberFormatException: For input string: "D:\zookeeper-3.7.0\bin\..\conf\zoo.cfg"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Integer.parseInt(Integer.java:580)
at java.lang.Integer.parseInt(Integer.java:615)
at org.apache.zookeeper.server.ServerConfig.parse(ServerConfig.java:78)
at org.apache.zookeeper.server.ZooKeeperServerMain.initializeAndRun(ZooKeeperServerMain.java:110)
at org.apache.zookeeper.server.ZooKeeperServerMain.main(ZooKeeperServerMain.java:68)
at org.apache.zookeeper.server.quorum.QuorumPeerMain.initializeAndRun(QuorumPeerMain.java:141)
at org.apache.zookeeper.server.quorum.QuorumPeerMain.main(QuorumPeerMain.java:91)
2021-12-21 21:01:34,287 [myid:] - INFO [main:ZooKeeperServerMain@71] - Usage: ZooKeeperServerMain configfile | port datadir [ticktime] [maxcnxns]
Usage: ZooKeeperServerMain configfile | port datadir [ticktime] [maxcnxns]
2021-12-21 21:01:34,293 [myid:] - INFO [main:ZKAuditProvider@42] - ZooKeeper audit is disabled.
2021-12-21 21:01:34,326 [myid:] - ERROR [main:ServiceUtils@42] - Exiting JVM with code 2
A机器配置如下conf1/zoo.cfg
tickTime = 2000
dataDir = D:/zookeeper-3.7.0/zk/data/1
dataLogDir = D:/zookeeper-3.7.0/zk/log/1
clientPort = 2181
initLimit = 10
syncLimit = 5
server.1=127.0.0.1:2888:3888
server.2=127.0.0.1:2889:3889
server.3=127.0.0.1:2890:3890
B机器配置如下conf2/zoo.cfg
tickTime = 2000
dataDir = D:/zookeeper-3.7.0/zk/data/2
dataLogDir = D:/zookeeper-3.7.0/zk/log/2
clientPort = 2182
initLimit = 10
syncLimit = 5
server.1=127.0.0.1:2888:3888
server.2=127.0.0.1:2889:3889
server.3=127.0.0.1:2890:3890
C机器配置如下conf3/zoo.cfg
tickTime = 2000
dataDir = D:/zookeeper-3.7.0/zk/data/3
dataLogDir = D:/zookeeper-3.7.0/zk/log/3
clientPort = 2183
initLimit = 10
syncLimit = 5
server.1=127.0.0.1:2888:3888
server.2=127.0.0.1:2889:3889
server.3=127.0.0.1:2890:3890
数据目录结构
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-Ft47qGQS-1640096713880)(img/zookeeper%E7%9A%84%E9%83%A8%E7%BD%B2/image-20211221205752043.png)]
myid文件配置
配置文件位置: D:/zookeeper-3.7.0/zkn/data/myid
其中n表示1~3
A机器配置如下
1
B机器配置如下
2
C机器配置如下
3
需要确保每台服务器的 myid 文件中数字不同,并且和自己所在机器的 zoo.cfg 中 server.id=host:port:port 的id值一样。id的范围是1~255。
启动ZooKeeper
复制zkServer.cmd适当修改命令重命名为zkServer-1.cmd,zkServer-2.cmd,zkServer-3.cmd
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-6kZqLBG4-1640096713881)(img/zookeeper%E7%9A%84%E9%83%A8%E7%BD%B2/image-20211221213250495.png)]
分别添加
set ZOOCFG=..\conf1\zoo.cfg
set ZOOCFG=..\conf2\zoo.cfg
set ZOOCFG=..\conf3\zoo.cfg
其中一个示例
@echo off
REM Licensed to the Apache Software Foundation (ASF) under one or more
REM contributor license agreements. See the NOTICE file distributed with
REM this work for additional information regarding copyright ownership.
REM The ASF licenses this file to You under the Apache License, Version 2.0
REM (the "License"); you may not use this file except in compliance with
REM the License. You may obtain a copy of the License at
REM
REM http://www.apache.org/licenses/LICENSE-2.0
REM
REM Unless required by applicable law or agreed to in writing, software
REM distributed under the License is distributed on an "AS IS" BASIS,
REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
REM See the License for the specific language governing permissions and
REM limitations under the License.
setlocal
call "%~dp0zkEnv.cmd"
set ZOOMAIN=org.apache.zookeeper.server.quorum.QuorumPeerMain
set ZOO_LOG_FILE=zookeeper-%USERNAME%-server-%COMPUTERNAME%.log
REM 添加在这里
set ZOOCFG=..\conf1\zoo.cfg
echo on
call %JAVA% "-Dzookeeper.log.dir=%ZOO_LOG_DIR%" "-Dzookeeper.root.logger=%ZOO_LOG4J_PROP%" "-Dzookeeper.log.file=%ZOO_LOG_FILE%" "-XX:+HeapDumpOnOutOfMemoryError" "-XX:OnOutOfMemoryError=cmd /c taskkill /pid %%%%p /t /f" -cp "%CLASSPATH%" %ZOOMAIN% "%ZOOCFG%" %*
endlocal
另外类似
可以配置下环境变量
ZOOKEEPER_HOME=D:\zookeeper-3.7.0
Path=%ZOOKEEPER_HOME%\bin
cd bin
zkServer-1.cmd
zkServer-2.cmd
zkServer-3.cmd
报错:Address unresolved: 127.0.0.1:3888 at
2021-12-21 21:39:35,429 [myid:] - ERROR [main:QuorumPeerMain@99] - Invalid config, exiting abnormally
org.apache.zookeeper.server.quorum.QuorumPeerConfig$ConfigException: Address unresolved: 127.0.0.1:3888
at org.apache.zookeeper.server.quorum.QuorumPeer$QuorumServer.initializeWithAddressString(QuorumPeer.java:357)
at org.apache.zookeeper.server.quorum.QuorumPeer$QuorumServer.(QuorumPeer.java:278)
at org.apache.zookeeper.server.quorum.QuorumPeer$QuorumServer.(QuorumPeer.java:273)
at org.apache.zookeeper.server.quorum.flexible.QuorumMaj.(QuorumMaj.java:92)
at org.apache.zookeeper.server.quorum.QuorumPeerConfig.createQuorumVerifier(QuorumPeerConfig.java:658)
at org.apache.zookeeper.server.quorum.QuorumPeerConfig.parseDynamicConfig(QuorumPeerConfig.java:689)
at org.apache.zookeeper.server.quorum.QuorumPeerConfig.setupQuorumPeerConfig(QuorumPeerConfig.java:663)
at org.apache.zookeeper.server.quorum.QuorumPeerConfig.parseProperties(QuorumPeerConfig.java:491)
at org.apache.zookeeper.server.quorum.QuorumPeerConfig.parse(QuorumPeerConfig.java:194)
at org.apache.zookeeper.server.quorum.QuorumPeerMain.initializeAndRun(QuorumPeerMain.java:125)
at org.apache.zookeeper.server.quorum.QuorumPeerMain.main(QuorumPeerMain.java:91)
Invalid config, exiting abnormally
最好发现是3888后面有个空格,-_-||
server.1=127.0.0.1:2888:3888空格
重新启动,一切ok
cd bin
zkServer-1.cmd
zkServer-2.cmd
zkServer-3.cmd
D:\zookeeper-3.7.0\conf1>jps
18048 QuorumPeerMain
22576 QuorumPeerMain
21684 QuorumPeerMain
19912 RemoteMavenServer36
7608
18348 Jps
连接到集群
D:\zookeeper-3.7.0\bin>zkCli.cmd -server 127.0.0.1:2181
WatchedEvent state:SyncConnected type:None path:null
[zk: 127.0.0.1:2181(CONNECTED) 0]
查看集群节点详细信息: ls -s / 和旧版的 ls2 / 对应
[zk: 127.0.0.1:2181(CONNECTED) 1] ls -s /
[zookeeper] ##默认的一个节点 zookeeper
cZxid = 0x0
ctime = Thu Jan 01 08:00:00 CST 1970
mZxid = 0x0
mtime = Thu Jan 01 08:00:00 CST 1970
pZxid = 0x0
cversion = -1
dataVersion = 0
aclVersion = 0
ephemeralOwner = 0x0
dataLength = 0
numChildren = 1
[zk: 127.0.0.1:2181(CONNECTED) 2]
创建节点: create /zk ‘test1’
[zk: 127.0.0.1:2181(CONNECTED) 2] create /zk 'test1'
Created /zk
创建临时节顺序节点: create -es /zk/temp
[zk: 127.0.0.1:2181(CONNECTED) 4] create -es /zk/temp
Created /zk/temp0000000000
[zk: 127.0.0.1:2181(CONNECTED) 5] ls -s /zk
[temp0000000000]
cZxid = 0x100000004
ctime = Tue Dec 21 22:08:08 CST 2021
mZxid = 0x100000004
mtime = Tue Dec 21 22:08:08 CST 2021
pZxid = 0x100000005
cversion = 1
dataVersion = 0
aclVersion = 0
ephemeralOwner = 0x0
dataLength = 5
numChildren = 1
[zk: 127.0.0.1:2181(CONNECTED) 6] ls /zk
[temp0000000000]
[zk: 127.0.0.1:2181(CONNECTED) 7] create -es /zk/temp
Created /zk/temp0000000001
设置节点数据: set /zk/temp ‘数据将会设置到那个节点上’
[zk: 127.0.0.1:2181(CONNECTED) 8] set /zk/temp '数据将会设置到那个节点上'
Node does not exist: /zk/temp
## 说明顺序节点也必须指定哪一个,不会默认设置第一个
[zk: 127.0.0.1:2181(CONNECTED) 9] set /zk/temp0000000001 '数据将会设置到那个节点上'
获取节点数据
[zk: 127.0.0.1:2181(CONNECTED) 3] get /zk
test1
删除节点: delete /zk
[zk: 127.0.0.1:2181(CONNECTED) 10] delete /zk
Node not empty: /zk
递归删除: rmr /zk 新版使用 deleteall /zk
Command not found: Command not found rmr
[zk: 127.0.0.1:2181(CONNECTED) 16] deleteall /zk
帮助命令: help
Command not found: Command not found help
ZooKeeper -server host:port -client-configuration properties-file cmd args
addWatch [-m mode] path # optional mode is one of [PERSISTENT, PERSISTENT_RECURSIVE] - default is PERSISTENT_RECURSIVE
addauth scheme auth
close
config [-c] [-w] [-s]
connect host:port
create [-s] [-e] [-c] [-t ttl] path [data] [acl]
delete [-v version] path
deleteall path [-b batch size]
delquota [-n|-b|-N|-B] path
get [-s] [-w] path
getAcl [-s] path
getAllChildrenNumber path
getEphemerals path
history
listquota path
ls [-s] [-w] [-R] path
printwatches on|off
quit
reconfig [-s] [-v version] [[-file path] | [-members serverID=host:port1:port2;port3[,...]*]] | [-add serverId=host:port1:port2;port3[,...]]* [-remove serverId[,...]*]
redo cmdno
removewatches path [-c|-d|-a] [-l]
set [-s] [-v version] path data
setAcl [-s] [-v version] [-R] path acl
setquota -n|-b|-N|-B val path
stat [-w] path
sync path
version
whoami
Command not found: Command not found h
help: 查看命令帮助
退出客户端: quit
[zk: 127.0.0.1:2181(CONNECTED) 20] quit
WATCHER::
2021-12-21 22:20:23,270 [myid:] - INFO [main:ZooKeeper@1232] - Session: 0x1001144a7670001 closed
集群模式
略,我将会在linux系统上搭建集群模式