使用Java VisualVM远程监控Tomcat


    1. Tomcat环境变量指定的好习惯html

    安装完Tomcat以后,配置CATALINA_HOME和CATALINA_BASE环境变量,若是须要指定环境变量或者JVM参数值,根据catalina.sh文件中的注释说明单独在setenv.sh或者setenv.bat文件中指定,这样catalina.sh在执行的时候会自动读取。java

   

   2. 配置启用Tomcat JMX Remotetomcat

      Java Visual VM远程监控Tomcat,配置参见:bash


JAVA_OPTS="
	-Djava.rmi.server.hostname=192.168.88.29
	-Dcom.sun.management.jmxremote
	-Dcom.sun.management.jmxremote.port=8089
	-Dcom.sun.management.jmxremote.ssl=false
	-Dcom.sun.management.jmxremote.authenticate=true
	-Dcom.sun.management.jmxremote.password.file=../conf/jmxremote.password
	-Dcom.sun.management.jmxremote.access.file=../conf/jmxremote.access"

 

    若是authenticate=false的时候不须要配置paasword.file和access.file.不然须要在access.file中指定用户名和读写权限,格式如:
服务器

   

monitorRole readonly
controlRole readwrite


    password.file中指定用户名和密码,格式如:ide


monitorRole tomcat
controlRole tomcat

    

    文档中有个小提示:The password file should be read-only and only accessible by the operating system user Tomcat is running as. (意思是password.file的读写权限是400,仅运行tomcat服务的操做系统用户能够访问)spa


     服务器上启动Tomcat,本地运行jvisual.exe配置JMX,链接远程Tomcat进行监控。操作系统

    wKiom1aD2fngYlLLAAC0B-3Ec5s765.png

  

     传送门:溯本逐源之visualvm jmx链接:http://visualvm.java.net/jmx_connections.html .net

相关文章
相关标签/搜索