通过JVisualVM连接服务器排查JVM
添加参数
-Djava.rmi.server.hostname=192.168.129.129 -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=1099 -Dcom.sun.management.jmxremote.authenticate=false -
Dcom.sun.management.jmxremote.ssl=false
参数解析
-Djava.rmi.server.hostname=192.168.129.129 #被监控服务器ip
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=1099 #开放连接的端口
-Dcom.sun.management.jmxremote.authenticate=false #关闭认证
-Dcom.sun.management.jmxremote.ssl=false #关闭SSL校验
#保存GC日志
-XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintTenuringDistribution -Xloggc:/jvm-gc-logs/gc-%t.log -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=20M
#保存OOM日志
-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/jvm-oom-logs/ -XX:ErrorFile=/jvm-oom-logs/hs_err.log