配置
在./bin/zkServer.sh中添加开启jmx的命令如下:
if [ "x$JMXLOCALONLY" = "x" ]
then
JMXLOCALONLY=false
fi
if [ "x$JMXDISABLE" = "x" ]
then
echo "JMX enabled by default" >&2
# for some reason these two options are necessary on jdk6 on Ubuntu
# accord to the docs they are not necessary, but otw jconsole cannot
# do a local attach
ZOOMAIN="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=10880 -Dcom.sun.management.jmxremote.authenticate=false -Djava.rmi.server.hostname=hzadg-mammut-platform8.server.163.org -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremo
te.local.only=$JMXLOCALONLY org.apache.zookeeper.server.quorum.QuorumPeerMain"
else
echo "JMX disabled by user request" >&2
ZOOMAIN="org.apache.zookeeper.server.quorum.QuorumPeerMain"
fi
基于jconsole监控
参考:
* https://stackoverflow.com/questions/834581/remote-jmx-connection