Java jcmd 开启和关闭 JMX

JMX jcmd 诊断工具 About 1,677 words

关于 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
Views: 4,665 · Posted: 2021-08-10

————        END        ————

Give me a Star, Thanks:)

https://github.com/fendoudebb/LiteNote

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

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


Today On History
Browsing Refresh