为了方便在本地开发环境进行调试,希望在win10环境中安装一个zookeeper

安装:

下载:

下载最新的stable版

zookeeper-3.4.12.tar.gz

配置环境变量:

ZOOKEEPER_HOME=D:\Program Files\zookeeper-3.4.12

PATH=%ZOOKEEPER_HOME%\bin

目录说明:

bin:

.sh 为 linux 环境

.cmd 为 windows 环境

conf:

zoo_sample.cfg 为样例配置文件,需要修改自己的名称,一般为 zoo.cfg

log4j.properties 为日志配置文件

contrib

contrib 为一些常用于操作 zk 的工具包

lib

zk 依赖的某些包

recipes

zk 某些用法的代码实例

dist-maven

maven 编译后的发布目录

配置文件说明:

启动zk前,你需要做的就是将 zoo_sample.cfg 改名为 zoo.cfg,因为 Zookeeper 在启动时会找这个文件作为默认配置文件。

下面详细介绍一下,这个配置文件中各个配置项的意义。

# 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=C:\\Users\\qhong\\zookeeper-3.4.5\\data
dataLogDir=C:\\Users\\qhong\\zookeeper-3.4.5\\log
# the port at which the clients will connect
clientPort=2181
#
# 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
  • tickTime:这个时间是作为 Zookeeper 服务器之间或客户端与服务器之间维持心跳的时间间隔,也就是每个 tickTime 时间就会发送一个心跳。
  • dataDir:顾名思义就是 Zookeeper 保存数据的目录,默认情况下,Zookeeper 将写数据的日志文件也保存在这个目录里。
  • dataLogDir:顾名思义就是 Zookeeper 保存日志文件的目录
  • clientPort:这个端口就是客户端连接 Zookeeper 服务器的端口,Zookeeper 会监听这个端口,接受客户端的访问请求。

启动:

启动服务端:

D:\Program Files\zookeeper-3.4.12\bin
$ zkServer.cmd call "D:\Program Files\Java\jdk1.8.0"\bin\java "-Dzookeeper.log.dir=D:\Program Files\zookeeper-3.4.12\bin\.." "-Dzookeeper.root.logger=INFO,CONSOLE" -cp "D:\Program Files\zookeeper-3.4.12\bin\..\build\classes;D:\Program Files\zookeeper-3.4.12\bin\..\build\lib\*;D:\Program Files\zookeeper-3.4.12\bin\..\*;D:\Program Files\zookeeper-3.4.12\bin\..\lib\*;D:\Program Files\zookeeper-3.4.12\bin\..\conf" org.apache.zookeeper.server.quorum.QuorumPeerMain "D:\Program Files\zookeeper-3.4.12\bin\..\conf\zoo.cfg"
2018-12-04 11:14:28,112 [myid:] - INFO [main:QuorumPeerConfig@136] - Reading configuration from: D:\Program Files\zookeeper-3.4.12\bin\..\conf\zoo.cfg
2018-12-04 11:14:28,127 [myid:] - INFO [main:DatadirCleanupManager@78] - autopurge.snapRetainCount set to 3
2018-12-04 11:14:28,127 [myid:] - INFO [main:DatadirCleanupManager@79] - autopurge.purgeInterval set to 0
2018-12-04 11:14:28,128 [myid:] - INFO [main:DatadirCleanupManager@101] - Purge task is not scheduled.
2018-12-04 11:14:28,130 [myid:] - WARN [main:QuorumPeerMain@116] - Either no config or no quorum defined in config, running in standalone mode
2018-12-04 11:14:28,210 [myid:] - INFO [main:QuorumPeerConfig@136] - Reading configuration from: D:\Program Files\zookeeper-3.4.12\bin\..\conf\zoo.cfg
2018-12-04 11:14:28,211 [myid:] - INFO [main:ZooKeeperServerMain@98] - Starting server
2018-12-04 11:14:37,250 [myid:] - INFO [main:Environment@100] - Server environment:zookeeper.version=3.4.12-e5259e437540f349646870ea94dc2658c4e44b3b, built on 03/27/2018 03:55 GMT
2018-12-04 11:14:37,250 [myid:] - INFO [main:Environment@100] - Server environment:host.name=hongda
2018-12-04 11:14:37,251 [myid:] - INFO [main:Environment@100] - Server environment:java.version=1.8.0_181
2018-12-04 11:14:37,251 [myid:] - INFO [main:Environment@100] - Server environment:java.vendor=Oracle Corporation 2018-12-04 11:14:37,251 [myid:] - INFO [main:Environment@100] - Server environment:java.home=D:\Program Files\Java\jdk1.8.0\jre
2018-12-04 11:14:37,252 [myid:] - INFO [main:Environment@100] - Server environment:java.class.path=D:\Program Files\zookeeper-3.4.12\bin\..\build\classes;D:\Program Files\zookeeper-3.4.12\bin\..\build\lib\*;D:\Program Files\zookeeper-3.4.12\bin\..\zookeeper-3.4.12.jar;D:\Program Files\zookeeper-3.4.12\bin\..\lib\audience-annotations-0.5.0.jar;D:\Program Files\zookeeper-3.4.12\bin\..\lib\jline-0.9.94.jar;D:\Program Files\zookeeper-3.4.12\bin\..\lib\log4j-1.2.17.jar;D:\Program Files\zookeeper-3.4.12\bin\..\lib\netty-3.10.6.Final.jar;D:\Program Files\zookeeper-3.4.12\bin\..\lib\slf4j-api-1.7.25.jar;D:\Program Files\zookeeper-3.4.12\bin\..\lib\slf4j-log4j12-1.7.25.jar;D:\Program Files\zookeeper-3.4.12\bin\..\conf
2018-12-04 11:14:37,253 [myid:] - INFO [main:Environment@100] - Server environment:java.library.path=D:\Program Files\Java\jdk1.8.0\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;D:\Program Files\cmder\bin;D:\Program Files\cmder\vendor\conemu-maximus5\ConEmu\Scripts;D:\Program Files\cmder\vendor\conemu-maximus5;D:\Program Files\cmder\vendor\conemu-maximus5\ConEmu;D:\Program Files\nodejs\node_global;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;%ANDROID_HOME%;%ANDROID_HOME%\tools;%ANDROID_HOME%\build-tools;%ANDROID_HOME%\platform-tools;D:\Program Files\Tomcat8\bin;D:\Program Files\Java\jdk1.8.0\bin;D:\Program Files\Java\jdk1.8.0\jre\bin;D:\Program Files\MySQL\bin;D:\Program Files (x86)\JetBrains\IDEA Configuration And Cache\gradle\bin;D:\Program Files (x86)\JetBrains\IDEA Configuration And Cache\maven\bin;D:\Program Files\cmder;D:\Program Files\nodejs;D:\Program Files\curl\bin;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;D:\Program Files\Microsoft VS Code\bin;D:\Program Files (x86)\JetBrains\IDEA Configuration And Cache\gradle\bin;D:\Program Files\Git\cmd;C:\Program Files\TortoiseGit\bin;D:\Program Files\Python\Python36\Scripts\;D:\Program Files\Python\Python36\;C:\Users\qhong\AppData\Local\Microsoft\WindowsApps;D:\Program Files\Microsoft VS Code\bin;C:\Program Files\Bandizip\;C:\Users\qhong\AppData\Local\Pandoc\;C:\Program Files\smartmontools\bin;C:\Users\qhong\AppData\Local\Microsoft\WindowsApps;D:\Program Files\Git\mingw64;D:\Program Files\Git\usr\bin;.
2018-12-04 11:14:37,257 [myid:] - INFO [main:Environment@100] - Server environment:java.io.tmpdir=C:\Users\qhong\AppData\Local\Temp\
2018-12-04 11:14:37,258 [myid:] - INFO [main:Environment@100] - Server environment:java.compiler=<NA>
2018-12-04 11:14:37,259 [myid:] - INFO [main:Environment@100] - Server environment:os.name=Windows 10
2018-12-04 11:14:37,260 [myid:] - INFO [main:Environment@100] - Server environment:os.arch=amd64
2018-12-04 11:14:37,260 [myid:] - INFO [main:Environment@100] - Server environment:os.version=10.0
2018-12-04 11:14:37,260 [myid:] - INFO [main:Environment@100] - Server environment:user.name=qhong
2018-12-04 11:14:37,261 [myid:] - INFO [main:Environment@100] - Server environment:user.home=C:\Users\qhong
2018-12-04 11:14:37,261 [myid:] - INFO [main:Environment@100] - Server environment:user.dir=D:\Program Files\zookeeper-3.4.12\bin
2018-12-04 11:14:37,277 [myid:] - INFO [main:ZooKeeperServer@835] - tickTime set to 2000
2018-12-04 11:14:37,278 [myid:] - INFO [main:ZooKeeperServer@844] - minSessionTimeout set to -1
2018-12-04 11:14:37,278 [myid:] - INFO [main:ZooKeeperServer@853] - maxSessionTimeout set to -1
2018-12-04 11:14:38,473 [myid:] - INFO [main:ServerCnxnFactory@117] - Using org.apache.zookeeper.server.NIOServerCnxnFactory as server connection factory
2018-12-04 11:14:38,477 [myid:] - INFO [main:NIOServerCnxnFactory@89] - binding to port 0.0.0.0/0.0.0.0:2181

查看:

D:\Development\payment-server (master -> origin)
$ netstat -ano|grep "2181"
TCP 0.0.0.0:2181 0.0.0.0:0 LISTENING 19912
TCP 18.16.202.169:4403 18.16.200.41:2181 ESTABLISHED 18436
TCP 18.16.202.169:10786 18.16.200.43:2181 ESTABLISHED 13780
TCP [::]:2181 [::]:0 LISTENING 19912 D:\Development\payment-server (master -> origin)
$ tasklist | findstr "19912"
java.exe 19912 Console 1 44,660 K

启动客户端:

D:\Program Files\zookeeper-3.4.12\bin
$ zkCli.cmd -server 127.0.0.1:2181
Connecting to 127.0.0.1:2181
2018-12-04 11:29:00,775 [myid:] - INFO [main:Environment@100] - Client environment:zookeeper.version=3.4.12-e5259e437540f349646870ea94dc2658c4e44b3b, built on 03/27/2018 03:55 GMT
2018-12-04 11:29:00,779 [myid:] - INFO [main:Environment@100] - Client environment:host.name=hongda
2018-12-04 11:29:00,779 [myid:] - INFO [main:Environment@100] - Client environment:java.version=1.8.0_181
2018-12-04 11:29:00,781 [myid:] - INFO [main:Environment@100] - Client environment:java.vendor=Oracle Corporation 2018-12-04 11:29:00,782 [myid:] - INFO [main:Environment@100] - Client environment:java.home=D:\Program Files\Java\jdk1.8.0\jre
2018-12-04 11:29:00,782 [myid:] - INFO [main:Environment@100] - Client environment:java.class.path=D:\Program Files\zookeeper-3.4.12\bin\..\build\classes;D:\Program Files\zookeeper-3.4.12\bin\..\build\lib\*;D:\Program Files\zookeeper-3.4.12\bin\..\zookeeper-3.4.12.jar;D:\Program Files\zookeeper-3.4.12\bin\..\lib\audience-annotations-0.5.0.jar;D:\Program Files\zookeeper-3.4.12\bin\..\lib\jline-0.9.94.jar;D:\Program Files\zookeeper-3.4.12\bin\..\lib\log4j-1.2.17.jar;D:\Program Files\zookeeper-3.4.12\bin\..\lib\netty-3.10.6.Final.jar;D:\Program Files\zookeeper-3.4.12\bin\..\lib\slf4j-api-1.7.25.jar;D:\Program Files\zookeeper-3.4.12\bin\..\lib\slf4j-log4j12-1.7.25.jar;D:\Program Files\zookeeper-3.4.12\bin\..\conf
2018-12-04 11:29:00,783 [myid:] - INFO [main:Environment@100] - Client environment:java.library.path=D:\Program Files\Java\jdk1.8.0\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;D:\Program Files\cmder\bin;D:\Program Files\cmder\vendor\conemu-maximus5\ConEmu\Scripts;D:\Program Files\cmder\vendor\conemu-maximus5;D:\Program Files\cmder\vendor\conemu-maximus5\ConEmu;D:\Program Files\nodejs\node_global;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;%ANDROID_HOME%;%ANDROID_HOME%\tools;%ANDROID_HOME%\build-tools;%ANDROID_HOME%\platform-tools;D:\Program Files\Tomcat8\bin;D:\Program Files\Java\jdk1.8.0\bin;D:\Program Files\Java\jdk1.8.0\jre\bin;D:\Program Files\MySQL\bin;D:\Program Files (x86)\JetBrains\IDEA Configuration And Cache\gradle\bin;D:\Program Files (x86)\JetBrains\IDEA Configuration And Cache\maven\bin;D:\Program Files\cmder;D:\Program Files\nodejs;D:\Program Files\curl\bin;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;D:\Program Files\Microsoft VS Code\bin;D:\Program Files (x86)\JetBrains\IDEA Configuration And Cache\gradle\bin;D:\Program Files\Git\cmd;C:\Program Files\TortoiseGit\bin;D:\Program Files\Python\Python36\Scripts\;D:\Program Files\Python\Python36\;C:\Users\qhong\AppData\Local\Microsoft\WindowsApps;D:\Program Files\Microsoft VS Code\bin;C:\Program Files\Bandizip\;C:\Users\qhong\AppData\Local\Pandoc\;C:\Program Files\smartmontools\bin;C:\Users\qhong\AppData\Local\Microsoft\WindowsApps;D:\Program Files\Git\mingw64;D:\Program Files\Git\usr\bin;.
2018-12-04 11:29:00,787 [myid:] - INFO [main:Environment@100] - Client environment:java.io.tmpdir=C:\Users\qhong\AppData\Local\Temp\
2018-12-04 11:29:00,788 [myid:] - INFO [main:Environment@100] - Client environment:java.compiler=<NA>
2018-12-04 11:29:00,788 [myid:] - INFO [main:Environment@100] - Client environment:os.name=Windows 10
2018-12-04 11:29:00,788 [myid:] - INFO [main:Environment@100] - Client environment:os.arch=amd64
2018-12-04 11:29:00,789 [myid:] - INFO [main:Environment@100] - Client environment:os.version=10.0
2018-12-04 11:29:00,789 [myid:] - INFO [main:Environment@100] - Client environment:user.name=qhong
2018-12-04 11:29:00,789 [myid:] - INFO [main:Environment@100] - Client environment:user.home=C:\Users\qhong
2018-12-04 11:29:00,789 [myid:] - INFO [main:Environment@100] - Client environment:user.dir=D:\Program Files\zookeeper-3.4.12\bin
2018-12-04 11:29:00,792 [myid:] - INFO [main:ZooKeeper@441] - Initiating client connection, connectString=127.0.0.1:2181 sessionTimeout=30000 watcher=org.apache.zookeeper.ZooKeeperMain$MyWatcher@67424e82
Welcome to ZooKeeper!
2018-12-04 11:29:02,164 [myid:] - INFO [main-SendThread(127.0.0.1:2181):ClientCnxn$SendThread@1028] - Opening socket connection to server 127.0.0.1/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error)
2018-12-04 11:29:02,169 [myid:] - INFO [main-SendThread(127.0.0.1:2181):ClientCnxn$SendThread@878] - Socket connection established to 127.0.0.1/127.0.0.1:2181, initiating session
JLine support is enabled
2018-12-04 11:29:02,216 [myid:] - INFO [main-SendThread(127.0.0.1:2181):ClientCnxn$SendThread@1302] - Session establishment complete on server 127.0.0.1/127.0.0.1:2181, sessionid = 0x10029a625410000, negotiated timeout = 30000 WATCHER:: WatchedEvent state:SyncConnected type:None path:null

操作命令:

ls:

[zk: 127.0.0.1:2181(CONNECTED) 1] ls /
[zookeeper]

create:

[zk: 127.0.0.1:2181(CONNECTED) 2] create /name hongdada
Created /name
[zk: 127.0.0.1:2181(CONNECTED) 4] ls /
[name, zookeeper]

get:

[zk: 127.0.0.1:2181(CONNECTED) 5] get /name
hongdada
cZxid = 0x2
ctime = Tue Dec 04 13:08:06 CST 2018
mZxid = 0x2
mtime = Tue Dec 04 13:08:06 CST 2018
pZxid = 0x2
cversion = 0
dataVersion = 0
aclVersion = 0
ephemeralOwner = 0x0
dataLength = 8
numChildren = 0

set:

[zk: 127.0.0.1:2181(CONNECTED) 7] set /name hondadadada
cZxid = 0x2
ctime = Tue Dec 04 13:08:06 CST 2018
mZxid = 0x3
mtime = Tue Dec 04 13:09:03 CST 2018
pZxid = 0x2
cversion = 0
dataVersion = 1
aclVersion = 0
ephemeralOwner = 0x0
dataLength = 11
numChildren = 0

delete:

delete只能删除不包含子节点的节点

[zk: 127.0.0.1:2181(CONNECTED) 50] ls /dubbo/com.jsy.order.api.OrderFacade
[configurators, providers]
[zk: 127.0.0.1:2181(CONNECTED) 52] delete /dubbo/com.jsy.order.api.OrderFacade/providers
[zk: 127.0.0.1:2181(CONNECTED) 53] ls /dubbo/com.jsy.order.api.OrderFacade/providers
Node does not exist: /dubbo/com.jsy.order.api.OrderFacade/providers
[zk: 127.0.0.1:2181(CONNECTED) 57] delete /dubbo/com.jsy.order.api.OrderFacade/configurators
[zk: 127.0.0.1:2181(CONNECTED) 58] delete /dubbo/com.jsy.order.api.OrderFacade

只能从最底部子节点一个个删除

rmr:

rmr:整个节点全部删除

[zk: 127.0.0.1:2181(CONNECTED) 60] ls  /dubbo
[com.jsy.order.api.OrderPayFacade, com.jsy.order.api.OrderTrialFacade, com.jsy.order.api.OpenAccountHttpFacade, com.jsy.payment.api.PaymentFacade, com.jsy.ufida.api.UfidaFacade, com.jsy.order.api.OpenAccountFacade, com.jsy.validation.ValidationFacade, com.jsy.payment.api.CustomerOpenAccountFacade, com.jsy.payment.api.PaymentQueryFacade, com.jsy.order.api.OrderUfidaFacade, com.jsy.order.api.OrderPayAccountFacade, com.jsy.order.api.OrderFacade2]
[zk: 127.0.0.1:2181(CONNECTED) 61] rmr /dubbo/com.jsy.order.api.OrderPayFacade
[zk: 127.0.0.1:2181(CONNECTED) 62] ls /dubbo
[com.jsy.order.api.OrderTrialFacade, com.jsy.order.api.OpenAccountHttpFacade, com.jsy.payment.api.PaymentFacade, com.jsy.ufida.api.UfidaFacade, com.jsy.order.api.OpenAccountFacade, com.jsy.validation.ValidationFacade, com.jsy.payment.api.CustomerOpenAccountFacade, com.jsy.payment.api.PaymentQueryFacade, com.jsy.order.api.OrderUfidaFacade, com.jsy.order.api.OrderPayAccountFacade, com.jsy.order.api.OrderFacade2]

常用四字命令

  1. 可以通过命令:echo stat|nc 127.0.0.1 2181 来查看哪个节点被选择作为follower或者leader
  2. 使用echo ruok|nc 127.0.0.1 2181 测试是否启动了该Server,若回复imok表示已经启动。
  3. echo dump| nc 127.0.0.1 2181 ,列出未经处理的会话和临时节点。
  4. echo kill | nc 127.0.0.1 2181 ,关掉server
  5. echo conf | nc 127.0.0.1 2181 ,输出相关服务配置的详细信息。
  6. echo cons | nc 127.0.0.1 2181 ,列出所有连接到服务器的客户端的完全的连接 / 会话的详细信息。
  7. echo envi |nc 127.0.0.1 2181 ,输出关于服务环境的详细信息(区别于 conf 命令)。
  8. echo reqs | nc 127.0.0.1 2181 ,列出未经处理的请求。
  9. echo wchs | nc 127.0.0.1 2181 ,列出服务器 watch 的详细信息。
  10. echo wchc | nc 127.0.0.1 2181 ,通过 session 列出服务器 watch 的详细信息,它的输出是一个与 watch 相关的会话的列表。
  11. echo wchp | nc 127.0.0.1 2181 ,通过路径列出服务器 watch 的详细信息。它输出一个与 session 相关的路径。

demo:

查看节点主从

$ echo stat|nc 18.16.200.41 2181
Zookeeper version: 3.4.6-1569965, built on 02/20/2014 09:09 GMT
Clients:
/18.16.200.77:12614[1](queued=0,recved=46681,sent=46689)
/18.16.200.110:53376[1](queued=0,recved=39408,sent=39415)
/18.16.200.10:56038[1](queued=0,recved=15366,sent=15366)
/18.16.200.70:54316[1](queued=0,recved=46825,sent=46825)
/18.16.200.91:63120[1](queued=0,recved=26343,sent=26343)
/18.16.200.52:35739[1](queued=0,recved=7116,sent=7116)
/18.16.200.10:58026[1](queued=0,recved=3592,sent=3592)
/18.16.200.91:63275[1](queued=0,recved=26098,sent=26098)
/18.16.200.91:63118[1](queued=0,recved=26289,sent=26289)
/18.16.202.169:6752[0](queued=0,recved=1,sent=0)
/18.16.200.110:58024[1](queued=0,recved=253,sent=253) Latency min/avg/max: 0/0/358
Received: 360617
Sent: 360677
Connections: 11
Outstanding: 0
Zxid: 0x6600007eea
Mode: follower
Node count: 24508

服务环境配置

$ echo envi|nc 18.16.200.41 2181
Environment:
zookeeper.version=3.4.6-1569965, built on 02/20/2014 09:09 GMT
host.name=slave1
java.version=1.8.0_91
java.vendor=Oracle Corporation
java.home=/usr/java/jdk1.8.0_91/jre
java.class.path=/root/zookeeper/zookeeper/bin/../build/classes:/root/zookeeper/zookeeper/bin/../build/lib/*.jar:/root/zookeeper/zookeeper/bin/../lib/slf4j-log4j12-1.6.1.jar:/root/zookeeper/zookeeper/bin/../lib/slf4j-api-1.6.1.jar:/root/zookeeper/zookeeper/bin/../lib/netty-3.7.0.Final.jar:/root/zookeeper/zookeeper/bin/../lib/log4j-1.2.16.jar:/root/zookeeper/zookeeper/bin/../lib/jline-0.9.94.jar:/root/zookeeper/zookeeper/bin/../zookeeper-3.4.6.jar:/root/zookeeper/zookeeper/bin/../src/java/lib/*.jar:/root/zookeeper/zookeeper/bin/../conf:
java.library.path=/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
java.io.tmpdir=/tmp
java.compiler=<NA>
os.name=Linux
os.arch=amd64
os.version=2.6.32-573.el6.x86_64
user.name=root
user.home=/root
user.dir=/root/zookeeper/zookeeper

连接服务器的客户端列表

$ echo cons|nc 18.16.200.41 2181
/18.16.200.77:12614[1](queued=0,recved=46690,sent=46698,sid=0x46ea06e94a60008,lop=PING,est=1574570480896,to=40000,lcxid=0x25,lzxid=0xffffffffffffffff,lresp=1575193282992,llat=0,minlat=0,avglat=0,maxlat=32)
/18.16.200.110:53376[1](queued=0,recved=39417,sent=39424,sid=0x16e9bb6d34e0031,lop=PING,est=1574668554910,to=40000,lcxid=0x5a,lzxid=0xffffffffffffffff,lresp=1575193283605,llat=0,minlat=0,avglat=0,maxlat=9)
/18.16.200.10:56038[1](queued=0,recved=15375,sent=15375,sid=0x16e9bb6d34e0004,lop=PING,est=1574988052683,to=40000,lcxid=0x3,lzxid=0xffffffffffffffff,lresp=1575193285636,llat=0,minlat=0,avglat=0,maxlat=13)
/18.16.200.70:54316[1](queued=0,recved=46834,sent=46834,sid=0x16e9bb6d34e0000,lop=PING,est=1574571154046,to=40000,lcxid=0xcf,lzxid=0xffffffffffffffff,lresp=1575193290380,llat=0,minlat=0,avglat=0,maxlat=36)
/18.16.200.91:63120[1](queued=0,recved=26352,sent=26352,sid=0x16e9bb6d34e0066,lop=PING,est=1574846855902,to=40000,lcxid=0x183,lzxid=0xffffffffffffffff,lresp=1575193284986,llat=0,minlat=0,avglat=0,maxlat=22)
/18.16.200.52:35739[1](queued=0,recved=7125,sent=7125,sid=0x16e9bb6d34e0080,lop=PING,est=1575099209870,to=40000,lcxid=0x4b,lzxid=0xffffffffffffffff,lresp=1575193278814,llat=0,minlat=0,avglat=0,maxlat=7)
/18.16.200.10:58026[1](queued=0,recved=3601,sent=3601,sid=0x16e9bb6d34e0081,lop=PING,est=1575145471096,to=40000,lcxid=0x13,lzxid=0xffffffffffffffff,lresp=1575193287128,llat=0,minlat=0,avglat=0,maxlat=3)
/18.16.200.91:63275[1](queued=0,recved=26107,sent=26107,sid=0x16e9bb6d34e0067,lop=PING,est=1574847291807,to=40000,lcxid=0xb4,lzxid=0xffffffffffffffff,lresp=1575193291118,llat=0,minlat=0,avglat=0,maxlat=23)
/18.16.200.91:63118[1](queued=0,recved=26298,sent=26298,sid=0x16e9bb6d34e0065,lop=PING,est=1574846855341,to=40000,lcxid=0x14d,lzxid=0xffffffffffffffff,lresp=1575193282832,llat=0,minlat=0,avglat=0,maxlat=20)
/18.16.202.169:6784[0](queued=0,recved=1,sent=0)
/18.16.200.110:58024[1](queued=0,recved=262,sent=262,sid=0x16e9bb6d34e009d,lop=PING,est=1575191812329,to=40000,lcxid=0x98,lzxid=0xffffffffffffffff,lresp=1575193285144,llat=0,minlat=0,avglat=1,maxlat=8)

举例查看zk中的dubbo配置

连接zk服务端,并查看:

 ls /dubbo
[com.jsy.payment.api.CustomerOpenAccountFacade, com.jsy.payment.api.PaymentFacade, com.jsy.payment.api.PaymentQueryFacade, com.jsy.payment.api.UserFacade, com.jsy.ufida.api.UfidaFacade, com.jsy.validation.ValidationFacade, com.shitou.message.api.MessageFacade]

查看具体服务:

ls /dubbo/com.jsy.payment.api.CustomerOpenAccountFacade
[configurators, consumers, providers, routers]

查看消费者配置:

ls /dubbo/com.jsy.payment.api.CustomerOpenAccountFacade/consumers

[consumer://10.244.5.166/com.jsy.payment.api.CustomerOpenAccountFacade?application=huishi-server&category=consumers&check=false&default.check=false&default.retries=0&default.timeout=30000&dubbo=2.8.4&group=test&interface=com.jsy.payment.api.CustomerOpenAccountFacade&methods=bankWhiteListValidation,bankOpenAccount,getCustomerBankWhiteList,getCustomerBankList,getBankCardId,getCertifiedBindingBank,syncBankCard,CustomerBankValidation,queryByBankCardMumber,getCustomerIdForBankCardId,validatePrePayBankCard&pid=1&protocol=dubbo&revision=2.0.0-SNAPSHOT&side=consumer&timestamp=1574757947590&version=1.0.0, consumer://10.244.5.23/com.jsy.payment.api.CustomerOpenAccountFacade?application=capital.schedule&async=false&category=consumers&check=false&default.retries=0&default.timeout=10000&dubbo=2.8.4&group=test&interface=com.jsy.payment.api.CustomerOpenAccountFacade&methods=bankWhiteListValidation,bankOpenAccount,getCustomerBankWhiteList,getCustomerBankList,getBankCardId,getCertifiedBindingBank,CustomerBankValidation,getCustomerIdForBankCardId&pid=1&protocol=dubbo&revision=1.0.0-SNAPSHOT&side=consumer&timeout=60000&timestamp=1574646066889&version=1.0.0, consumer://18.16.200.117/com.jsy.payment.api.CustomerOpenAccountFacade?application=huishi-server&category=consumers&check=false&default.check=false&default.retries=0&default.timeout=30000&dubbo=2.8.4&group=test&interface=com.jsy.payment.api.CustomerOpenAccountFacade&methods=bankWhiteListValidation,bankOpenAccount,getCustomerBankWhiteList,getBankCardId,getCustomerBankList,getCertifiedBindingBank,syncBankCard,queryByBankCardMumber,CustomerBankValidation,getCustomerIdForBankCardId,validatePrePayBankCard&pid=29322&protocol=dubbo&revision=2.0.0-SNAPSHOT&side=consumer&timestamp=1574764692627&version=1.0.0]

查看服务提供者配置:

ls /dubbo/com.jsy.payment.api.CustomerOpenAccountFacade/providers

[dubbo://10.244.5.221:20882/com.jsy.payment.api.CustomerOpenAccountFacade?anyhost=true&application=assets-payment-server&dubbo=2.8.4&generic=false&group=test&interface=com.jsy.payment.api.CustomerOpenAccountFacade&methods=bankWhiteListValidation,bankOpenAccount,getBankCardId,getCustomerBankWhiteList,getCustomerBankList,getCertifiedBindingBank,syncBankCard,CustomerBankValidation,queryByBankCardMumber,getCustomerIdForBankCardId,validatePrePayBankCard&pid=1&revision=2.0.0-SNAPSHOT&side=provider&timestamp=1574825462044&version=1.0.0]

参考:

Windows安装和使用zookeeper

Windows 安装 ZooKeeper

win10中命令操作Zookeeper的更多相关文章

  1. windows下cmd中命令操作

    windows下cmd中命令:   cls清空 上下箭头进行命令历史命令切换 ------------------------------------------------------------- ...

  2. ZooKeeper学习第三期---Zookeeper命令操作

    一.Zookeeper的四字命令 Zookeeper支持某些特定的四字命令字母与其的交互.他们大多数是查询命令,用来获取Zookeeper服务的当前状态及相关信息.用户在客户端可以通过telnet或n ...

  3. 【Zookeeper系列】Zookeeper命令操作(转)

    原文链接:https://www.cnblogs.com/sunddenly/p/4031881.html 一.Zookeeper的四字命令 Zookeeper支持某些特定的四字命令字母与其的交互.他 ...

  4. 5、Zookeeper命令操作

    一.Zookeeper的四字命令 Zookeeper支持某些特定的四字命令字母与其的交互.他们大多数是查询命令,用来获取Zookeeper服务的当前状态及相关信息.用户在客户端可以通过telnet或n ...

  5. 【转】ZooKeeper学习第二期--Zookeeper命令操作

    一.Zookeeper的四字命令 Zookeeper支持某些特定的四字命令字母与其的交互.他们大多数是查询命令,用来获取Zookeeper服务的当前状态及相关信息.用户在客户端可以通过telnet或n ...

  6. ZooKeeper系列(3)命令操作 (转)

    原文地址:http://www.cnblogs.com/wuxl360/p/5817524.html 一.Zookeeper的四字命令 Zookeeper支持某些特定的四字命令字母与其的交互.他们大多 ...

  7. Zookeeper命令操作

    Zookeeper支持某些特定的四字命令字母与其的交互.他们大多数是查询命令,用来获取Zookeeper服务的当前状态及相关信息.用户在客户端可以通过telnet或nc向Zookeeper提交相应的命 ...

  8. ZooKeeper学习第三期---Zookeeper命令操作(转)

    转载来源:https://www.cnblogs.com/sunddenly/p/4031881.html 一.Zookeeper的四字命令 Zookeeper支持某些特定的四字命令字母与其的交互.他 ...

  9. Zookeeper系列一:Zookeeper基础命令操作

    有些事不是努力就可以改变的,五十块的人民币设计的再好看,也没有一百块的招人喜欢. 前言 由于公司年底要更换办公地点,所以最近投了一下简历,发现面试官现在很喜欢问dubbo.zookeeper和高并发等 ...

随机推荐

  1. linux安装flash player来播放视频

    1下载64位flashplayer插件,可在此下载(偷偷赚俩金币,为省金币也可到官网去搜),得到flashplayer11_b2_install_lin_64_080811.tar.gz: http: ...

  2. Java多线程-----线程安全及解决机制

    1.什么是线程安全问题? 从某个线程开始访问到访问结束的整个过程,如果有一个访问对象被其他线程修改,那么对于当前线程而言就发生了线程安全问题: 如果在整个访问过程中,无一对象被其他线程修改,就是线程安 ...

  3. MySql 应用语句

    [1]MySQL基础语句 -- 查询mysql版本号 SELECT VERSION(); -- 创建数据库 DROP DATABASE IF EXISTS study; -- 如果存在先删除 CREA ...

  4. 前端和后台BUG区分方法

    测试工程师不只是负责发现问题,除了发现问题这种基本功外,定位问题,提出解决方案,提出预防方案也是要掌握的技能.这里先说定位问题的要求,定位问题要向深入,前提当然是对功能.产品的流程.开发方案.开发人员 ...

  5. kali长时间未使用导致数字签名过期无法更新源解决办法

    kali长时间未使用,数字签名会过期,从而导致无法更新源. apt-get update:从源(Source)服务器那里下载最新的软件包列: apt-get upgrade:对已经安装的软件包本身进行 ...

  6. tomcat 、NIO、netty 本质

    tomcat 基于 Socket,面向 web 浏览器的通信容器 nio 同步非阻塞的I/O模型 netty 通信框架,对 nio 的封装

  7. Linux基础命令---显示登录用户logname

    logname 显示当前登录的用户名称.此命令的适用范围:RedHat.RHEL.Ubuntu.CentOS.SUSE.openSUSE.Fedora. 1.语法        logname   2 ...

  8. react系列笔记1 用npx npm命令创建react app

    react系列笔记1 用npx npm命令创建react app create-react-app my-app是开始构建新的 React 单页应用程序的最佳方式.它已经为你设置好了开发环境,以便您可 ...

  9. shell命令行快捷键

    ctrl+a[A]:将光标移到命令行开头 ctrl+e[E]:将光标移到命令行结尾 ctrl+c[C]:强制终止命令执行 ctrl+u[U]:删除/剪切光标之前的所有字符 ctrl+y[Y]:粘贴ct ...

  10. tomcat 启动时遇到org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs

    当发生这样的错误的时候 org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet ...