JMX:
安裝配置
1、修改zookeeper的啟動腳本
vi zkServer.sh
找到啟動參數ZOOMAIN
修改為下面值(修改一項,新增4項):
-Dcom.sun.management.jmxremote.local.only=false
# jconsole.exe 連接的ip地址(zk所在機器的ip)
-Djava.rmi.server.hostname=192.168.147.133
# jconsole.exe 連接的端口號
-Dcom.sun.management.jmxremote.port=8989
-Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false
修改后的值為如下:
ZOOMAIN="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.local.only=false -Djava.rmi.server.hostname=192.168.147.135 -Dcom.sun.management.jmxremote.port=8989 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false org.apache.zookeeper.server.quorum.QuorumPeerMain"
2、修改其他服務器(步驟相同)
如果需要用jmx管理多台zk服務器,每台服務器的啟動腳本都需要進行如上修改。
3、安裝jdk(windows系統)
運行jmx必須安裝jdk
jdk安裝略
4、啟動jconsole.exe
在本機找到jconsole.exe(jdk自帶的工具,一般在:Java\jdk\bin目錄下):
雙擊點開
點擊連接按鈕
選擇:【不安全的連接】
ZooInspector:
安裝配置
1、下載文件
https://issues.apache.org/jira/secure/attachment/12436620/ZooInspector.zip
2、解壓ZooInspector.zip文件
解壓縮后點擊ZooInspector\build\zookeeper-dev-ZooInspector.jar后會出現以下界面
3、連接ZK
點擊左上角的綠色按鈕,輸入ZK Server的地址和端口
連接成功后就能看到ZK的節點數據信息. (發現很多歷史信息在zk里,並沒有清除)