2016年1月23日星期六

Zookeeper_003:使用ZooInspector监控ZooKeeper

环境:MAC OS X EI Capitan 10.11.2 + Zookeeper 3.4.6

ZooInspector 是 Zookeeper 自带的java jar包,无需下载,直接使用即可。

1.  在bin目录下创建zkInspector.sh启动脚本

#!/bin/sh
ZOOVERSION=3.4.6
ZOODIR=/Users/maping/Apache/zookeeper
ZOOBINDIR=/Users/maping/Apache/zookeeper/bin
ZOOCONTRIBDIR="$ZOODIR/contrib"
ZOOFATJAR="$ZOOCONTRIBDIR/fatjar/zookeeper-$ZOOVERSION-fatjar.jar"
ZOOINSPECTORDIR="$ZOOCONTRIBDIR/ZooInspector"
ZOOINSPECTOR="$ZOOINSPECTORDIR/zookeeper-$ZOOVERSION-ZooInspector.jar"

. "$ZOOBINDIR"/zkEnv.sh
CLASSPATH="$ZOOFATJAR:$ZOOINSPECTOR:$CLASSPATH"

cd $ZOOINSPECTORDIR
$JAVA "-Dzookeeper.log.dir=${ZOO_LOG_DIR}" "-Dzookeeper.root.logger=${ZOO_LOG4J_PROP}" \
-cp "$CLASSPATH" $CLIENT_JVMFLAGS $JVMFLAGS \
org.apache.zookeeper.inspector.ZooInspector "$@"


2.  输入连接参数
chmod a+x zkInspector.sh
./zkInspector.sh
 


3.  监控



参考文献:
1. http://www.tuicool.com/articles/bQj2E3
2. http://zhaoshijie.iteye.com/blog/2229068

没有评论: