I am There are other ways to use jmx for remote connection, so I won't record them one by one here.
- cd to the server
quoteJAVA_HOME/jre/lib/managementNow, let me say one more thing here, if you don't know the JAVA_HOME on the server, you can passquoteecho $JAVA_HOMEorquotewhereis javato find the jdk installation directory
-
quotechmod 600 jmxremote.password.templateandquotemanagement.properties
- put the directory below
quotejmxremote.password.templaterenamed toquotejmxremote.password, remove the comment from monitorRole QED in its content
- Modify management.properties
quotecom.sun.management.jmxremote.port= (change to the JMX port number you want) com.sun.management.jmxremote.ssl=false, com.sun.management.jmxremote.authenticate=falseNotes open
- Find the startup file of tomcat
quotecatalina.sh, find the JAVA_OPTS item and add it laterquote-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=(JMX port of previous manage.properties) -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate =false -Djava.rmi.server.hostname=(Server's IP)
Even if the modification is completed, start tomcat at this time, and then use netstat -na | grep (jmx port) to see that jmx is successfully started.
Then open the remote of visualvm, add the remote host, and add the server IP, you can detect it The tomcat process is monitored