前往小程序,Get更优阅读体验!
立即前往
发布
社区首页 >专栏 >Apache ZooKeeper - JMX监控 ZooKeeper 的运行状态

Apache ZooKeeper - JMX监控 ZooKeeper 的运行状态

作者头像
小小工匠
发布2021-08-17 16:23:20
发布2021-08-17 16:23:20
90100
代码可运行
举报
文章被收录于专栏:小工匠聊架构小工匠聊架构
运行总次数:0
代码可运行


Pre

为了应用服务能够持续稳定地对外提供服务,除了在部署的时候尽量采用分布式、集群服务等方式提高 ZooKeeper 服务的可靠性外,在服务上线运行的时候,我们还可以通过对 ZooKeeper 服务的运行状态进行监控,如运行 ZooKeeper 服务的生产服务器的 CPU 、内存、磁盘等使用情况来达到目的。在系统性能达到瓶颈的时候,可以增加服务器资源,以保证服务的稳定性。


JMX配置

主要是 输入 JMX 服务的端口号并禁止身份认证等配置

代码语言:javascript
代码运行次数:0
复制
-Djava.rmi.server.hostname=服务器的IP地址或者域名

-Dcom.sun.management.jmxremote.port=端口号

-Dcom.sun.management.jmxremote.ssl=false 

-Dcom.sun.management.jmxremote.authenticate=false 

连不上的话,别忘了检查

代码语言:javascript
代码运行次数:0
复制
 -Djava.rmi.server.hostname

java.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

代码语言:javascript
代码运行次数:0
复制
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监控的,只是这些参数木有值, 加上呗

主要是 输入 JMX 服务的端口号并禁止身份认证等配置

通过-Djava.rmi.server.hostname=192.168.126.136 jmx选项明确指定jmx server远程调用服务关联的ip地址为10.242.93.40

别忘了重启ZK哈


JConsle 通过 JMX访问远端 ZooKeeper服务

JConsole 是 JDK 自带的工具,用来监控程序运行的状态信息。

之所以能够通过 JConsole 连接 ZooKeeper 服务进行监控,是因为 ZooKeeper 支持 JMX(Java Management Extensions),即 Java 管理扩展,它是一个为应用程序、设备、系统等植入管理功能的框架。

JMX 可以跨越一系列异构操作系统平台、系统体系结构和网络传输协议,灵活地开发无缝集成的系统、网络和服务管理应用。我们可以通过 JMX 来访问和管理 ZooKeeper 服务集群。

完了 ,走了

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2020/12/22 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • Pre
  • JMX配置
  • OP
    • 开启 JMX
  • JConsle 通过 JMX访问远端 ZooKeeper服务
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档