【JVM】jvisualvm远程监控linux上java进程

1、启动java进程的命令

在启动命令中添加如下信息

-Djava.rmi.server.hostname=192.169.1.71 -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=10099 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false 

说明 

-Djava.rmi.server.hostname为java程序运行所在的机器ip
-Dcom.sun.management.jmxremote.port为端口,自定义,保证是未使用的端口即可。jconsole通过这个端口来连接。
-Dcom.sun.management.jmxremote.authenticate=false表示在jconsole连接时可以不用输入账号和密码

示例

nohup java  -Xms128M -Xmx256M  -Djava.rmi.server.hostname=192.169.1.71 -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=10099 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -jar appgateway-1.0.0.9.jar --spring.config.location=/usr/local/csnsh/ums/appgateway/application-appgateway.properties >appgateway.txt &

 

2、使用jvisualvm通过启动命令中的ip和端口进行连接

点击远程——》添加远程主机

 输入远程主机名,点击确定

 右键添加JMX连接,输入连接的ip和端口(上面启动命令中的ip和端口)

 点击确定,成功连接 ,右边是监控视图

 

posted @ 2020-05-14 11:12  harara  阅读(1660)  评论(0)    收藏  举报