1. 服務端配置
java啓動命令增加以下參數即可:
-Dcom.sun.management.jmxremote \
-Dcom.sun.management.jmxremote.local.only=false \
-Djava.rmi.server.hostname=test.xxx.com \
-Dcom.sun.management.jmxremote.port=18097 \
-Dcom.sun.management.jmxremote.rmi.port=18098 \
-Dcom.sun.management.jmxremote.ssl=false \
-Dcom.sun.management.jmxremote.authenticate=false \
-Xloggc:logs/gc.log \
參數説明:
不開啓SSL
-Dcom.sun.management.jmxremote.ssl=false
不開啓密碼驗證
-Dcom.sun.management.jmxremote.authenticate=false
2. 客户端配置
打開Java VisualVM
配置遠程連接連接
注意項:
主機填-Djava.rmi.server.hostname配置的主機
端口填-Dcom.sun.management.jmxremote.port配置的端口
配置-Dcom.sun.management.jmxremote.rmi.port不能省略