1.远程启动程序时开启jmx
-Dcom.sun.management.jmxremote.port=10099
是远程连接时候的端口,默认是1099
-Djava.rmi.server.hostname=10.132.6.77
是远程连接时候的地址
java \
-Djava.rmi.server.hostname=10.132.6.77 \
-Dcom.sun.management.jmxremote \
-Dcom.sun.management.jmxremote.port=10099 \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote.ssl=false \
-jar demo.jar --spring.profiles.active=pro &
2.本地使用jconsole连接
使用jconsole命令启动
确保安装了jdk,并配置了环境变量
jconsole
建立连接

查看效果

2.本地使用jvisualvm连接
使用jvisualvm命令启动
确保安装了jdk,并配置了环境变量
jvisualvm
建立连接

查看效果

网友评论