Apache ZooKeeper - JMX监控 ZooKeeper 的运行状态
文章目錄
- Pre
- JMX配置
- OP
- 開啟 JMX
- JConsle 通過 JMX訪問遠端 ZooKeeper服務
Pre
為了應用服務能夠持續(xù)穩(wěn)定地對外提供服務,除了在部署的時候盡量采用分布式、集群服務等方式提高 ZooKeeper 服務的可靠性外,在服務上線運行的時候,我們還可以通過對 ZooKeeper 服務的運行狀態(tài)進行監(jiān)控,如運行 ZooKeeper 服務的生產(chǎn)服務器的 CPU 、內(nèi)存、磁盤等使用情況來達到目的。在系統(tǒng)性能達到瓶頸的時候,可以增加服務器資源,以保證服務的穩(wěn)定性。
JMX配置
主要是 輸入 JMX 服務的端口號并禁止身份認證等配置
-Djava.rmi.server.hostname=服務器的IP地址或者域名-Dcom.sun.management.jmxremote.port=端口號-Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false連不上的話,別忘了檢查
-Djava.rmi.server.hostnamejava.rmi.server.hostname
The value of this property represents the host name string that should be associated with remote stubs for locally created remote objects, in order to allow clients to invoke methods on the remote object. The default value of this property is the IP address of the local host, in “dotted-quad” format.
By default, the remote stubs for locally created remote objects that are sent to client contains the IP address of the local host in dotted-quad format. For remote stubs to be associated with a specific interface address, the java.rmi.server.hostname system property must be set to IP address of that interface.
OP
開啟 JMX
查看zk的啟動腳本 zkServer.sh
ZOOMAIN="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=$JMXPORT -Dcom.sun.management.jmxremote.authenticate=$JMXAUTH -Dcom.sun.management.jmxremote.ssl=$JMXSSL -Dzookeeper.jmx.log4j.disable=$JMXLOG4J org.apache.zookeeper.server.quorum.QuorumPeerMain"可以看到,是支持jmx監(jiān)控的,只是這些參數(shù)木有值, 加上唄
主要是 輸入 JMX 服務的端口號并禁止身份認證等配置
通過-Djava.rmi.server.hostname=192.168.126.136 jmx選項明確指定jmx server遠程調(diào)用服務關聯(lián)的ip地址為10.242.93.40
別忘了重啟ZK哈
JConsle 通過 JMX訪問遠端 ZooKeeper服務
JConsole 是 JDK 自帶的工具,用來監(jiān)控程序運行的狀態(tài)信息。
之所以能夠通過 JConsole 連接 ZooKeeper 服務進行監(jiān)控,是因為 ZooKeeper 支持 JMX(Java Management Extensions),即 Java 管理擴展,它是一個為應用程序、設備、系統(tǒng)等植入管理功能的框架。
JMX 可以跨越一系列異構(gòu)操作系統(tǒng)平臺、系統(tǒng)體系結(jié)構(gòu)和網(wǎng)絡傳輸協(xié)議,靈活地開發(fā)無縫集成的系統(tǒng)、網(wǎng)絡和服務管理應用。我們可以通過 JMX 來訪問和管理 ZooKeeper 服務集群。
完了 ,走了
總結(jié)
以上是生活随笔為你收集整理的Apache ZooKeeper - JMX监控 ZooKeeper 的运行状态的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: leetcode - two-sum
- 下一篇: Apache ZooKeeper - F