VisualVm使用JMX的方式鏈接遠程JVM

一、在catalina.sh中添加配置以下:html

在其中「# ----- Execute The Requested Command -------------」以前插入一行(中間沒有換行):java

CATALINA_OPTS="$CATALINA_OPTS -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=8999 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Djava.rmi.server.hostname=機器IP"apache

特別注意:-Djava.rmi.server.hostname=機器IP這一行須要加上,否則可能本機能連上,遠程連不上。不少帖子中的介紹配置沒有這一行。tomcat

二、lsof -i:8999查看端口狀態:安全

三、使用visualVm監控遠程虛擬機:相對於使用jstatd的監控,使用jmx的方式會有更多的能夠監控的功能,如Threads等。.net

四、爲了安全起見,能夠採用配置鑑權的方式,詳見參考文獻中的介紹。本文再也不贅述server

參考文獻:https://blog.csdn.net/liuxigiant/article/details/40344699htm

http://tomcat.apache.org/tomcat-7.0-doc/monitoring.html#Enabling_JMX_Remoteblog

相關文章
相關標籤/搜索