Java jcmd 开启和关闭 JMX

Java jcmd JMX 大约 1677 字

关于 JMX

JMX开启后,可以使用VisualVMJMC等工具远程连接,观察服务运行情况、服务所在机器情况等。

开启远程 JMX

jcmd 12345 ManagementAgent.start jmxremote.port=15555 jmxremote.authenticate=false jmxremote.ssl=false

开启本地 JMX

jcmd 12345 ManagementAgent.start_local

查看 JMX 状态

jcmd 12345 ManagementAgent.status

输出:发现开启本地和远程两个JMX

12345:
Agent: enabled

Connection Type: local
Protocol       : rmi
Host           : 127.0.0.1
URL            : service:jmx:rmi://127.0.0.1/stub/xxx
Properties     :
  com.sun.management.jmxremote.authenticate = false
  com.sun.management.jmxremote.ssl.need.client.auth = false [default]
  com.sun.management.jmxremote.ssl = false
  com.sun.management.jmxremote.registry.ssl = false [default]
  com.sun.management.jmxremote.local.only = true [default]
  com.sun.management.jmxremote.password.file = jmxremote.password [default]
  com.sun.management.jmxremote.access.file = jmxremote.access [default]
  com.sun.management.config.file = management.properties [default]
  com.sun.management.jmxremote.port = 15555

Connection Type: remote
Protocol       : rmi
Host           : TestHost
URL            : service:jmx:rmi://TestHost/stub/xxx
Properties     :
  com.sun.management.jmxremote.authenticate = false
  com.sun.management.jmxremote.ssl.need.client.auth = false [default]
  com.sun.management.jmxremote.ssl = false
  com.sun.management.jmxremote.registry.ssl = false [default]
  com.sun.management.jmxremote.local.only = true [default]
  com.sun.management.jmxremote.password.file = jmxremote.password [default]
  com.sun.management.jmxremote.access.file = jmxremote.access [default]
  com.sun.management.config.file = management.properties [default]
  com.sun.management.jmxremote.port = 15555
阅读 357 · 发布于 2021-08-10

————        END        ————

扫描下方二维码关注公众号和小程序↓↓↓

扫描二维码关注我
昵称:
随便看看 换一批