动物园管理员 - 我在哪里找到"真实"正在运行的Zookeeper实例的版本?

时间:2018-01-05 23:44:53

标签: apache-zookeeper

我最近安装了一个新的ZK节点w / Exhibitor,它开始很好。当我执行telnet localhost 2181然后运行stats以查看版本时,即使我安装了3.4.11,我也会在输出中看到3.4.5版本。我试图找到ZooKeeper读取版本号的位置,但它只是一个.jar和一些lib文件。你知道我在哪里可以获得真实的"版本我应该在运行吗?谢谢!

这是我在执行telnet时看到的:

myserver:/tmp/zookeeper # telnet localhost 2181
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
stats
Zookeeper version: 3.4.5-1392090, built on 09/30/2012 17:52 GMT
Clients:
 /127.0.0.1:53133[0](queued=0,recved=1,sent=0)

Latency min/avg/max: 0/0/0
Received: 41
Sent: 40
Connections: 1
Outstanding: 0
Zxid: 0x0
Mode: standalone
Node count: 4
Connection closed by foreign host.

正在运行的流程(ps aux | grep zookeeper)显示:

myuser    19002  0.9  1.2 2618596 49596 ?       Sl   14:02   0:00 /usr/pkgs/java/1.8.0.92/bin/java -Dzookeeper.log.dir=/var/run/zookeeper/log -Dzookeeper.root.logger=WARN,ROLLINGFILE -cp /opt/zookeeper-server/default/bin/../build/classes:/opt/zookeeper-server/default/bin/../build/lib/*.jar:/opt/zookeeper-server/default/bin/../lib/slf4j-log4j12-1.6.1.jar:/opt/zookeeper-server/default/bin/../lib/slf4j-api-1.6.1.jar:/opt/zookeeper-server/default/bin/../lib/netty-3.10.5.Final.jar:/opt/zookeeper-server/default/bin/../lib/log4j-1.2.16.jar:/opt/zookeeper-server/default/bin/../lib/jline-0.9.94.jar:/opt/zookeeper-server/default/bin/../lib/exhibitor-1.6.0.jar:/opt/zookeeper-server/default/bin/../lib/audience-annotations-0.5.0.jar:/opt/zookeeper-server/default/bin/../zookeeper-3.4.11.jar:/opt/zookeeper-server/default/bin/../src/java/lib/*.jar:/var/run/zookeeper/conf: -server -Xmx1g -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.local.only=false org.apache.zookeeper.server.quorum.QuorumPeerMain /var/run/zookeeper/conf/zoo.cfg

3 个答案:

答案 0 :(得分:3)

cat zookeeper-server.log | grep zookeeper.version

... INFO服务器环境:zookeeper.version = 3.5.7 -f0fdd52973d373ffd9c86b81d99842dc2c7f660e,建于格林尼治标准时间02/10/2020 11:30(org.apache.zookeeper.server.ZooKeeperServer) .....

答案 1 :(得分:2)

假设您在本地主机上运行ZooKeeper,ZooKeeper支持四个字母命令:

$ echo "status" | nc  localhost 2181 | head -n 1
Zookeeper version: 3.4.9-3--1, built on Fri, 24 May 2019 08:57:53 +0100

使用一些bash魔术,您可以过滤出主要版本:

$ echo "status" | nc  localhost 2181 | head -n 1 | awk '{ print $3}' | cut -d "-" -f 1

答案 2 :(得分:0)

检查源后,似乎有一个名为Info的界面给出了版本号。可以在这里看到:https://github.com/apache/zookeeper/blob/master/src/java/main/org/apache/zookeeper/Version.java

因此,版本文件在构建时完成。