开启JMX远程监控

码农天地 -
开启JMX远程监控

参考:

Java_jvisualvm使用JMX连接远程机器(实践)1. 启动参数
java -server -Xms256M -Xmx256M -Xss256K   -XX:MetaspaceSize=256M -XX:MaxMetaspaceSize=256M  -Dfile.encoding=UTF-8 -Dsun.jun.encoding=UTF-8  -Djava.security.egd=file:/dev/./urandom  -Dio.netty.leakDetectionLevel=advanced  -Dcom.sun.management.jmxremote=true  -Dcom.sun.management.jmxremote.rmi.port=1919  -Dcom.sun.management.jmxremote.port=1919  -Dcom.sun.management.jmxremote.ssl=false  -Dcom.sun.management.jmxremote.authenticate=true  -Dcom.sun.management.jmxremote.local.only=false  -Dcom.sun.management.jmxremote.access.file=/etc/jmx/jmxremote.access  -Dcom.sun.management.jmxremote.password.file=/etc/jmx/jmxremote.password  -Djava.rmi.server.hostname=服务器公网ip  -jar foo.jar
2. authenticate文件配置jmxremote.access 

guest readonly admin readwrite

jmxremote.password   

guest guestpwd admin adminpwd

注意: 文件(jmxremote.access, jmxremote.password)内容不能有注释文件授权
chmod 600 jmxremote.access 
chmod 600 jmxremote.password 
chown root:root jmxremote.access 
chown root:root jmxremote.password
注意不能随便改, chmod 777都不行 否则启动会报错
Error: Password file read access must be restricted: /etc/jmx/jmxremote.password sun.management.AgentConfigurationError  at sun.management.jmxremote.ConnectorBootstrap.checkPasswordFile(ConnectorBootstrap.java:577) at sun.management.jmxremote.ConnectorBootstrap.startRemoteConnectorServer(ConnectorBootstrap.java:426) at sun.management.Agent.startAgent(Agent.java:262) at sun.management.Agent.startAgent(Agent.java:452)
jvisualvm连接

特别申明:本文内容来源网络,版权归原作者所有,如有侵权请立即与我们联系(cy198701067573@163.com),我们将及时处理。

Tags 标签

加个好友,技术交流

1628738909466805.jpg