开启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
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),我们将及时处理。
上一篇: Git重磅推荐!5 款强大的开源报表工具