Jconsole or VisualVM monitoring remote hosts (Ali cloud, jdk11 or 8)

ready: 

1 package a war or jar package, and here I use the springboot

2 linux environment, install tomcat, jdk, I used jdk11 and tomcat9, jdk11 permission to copy the file path and 8 bit different, this note

3 Whether Jconsole or VisualVM, project or tomcat configuration are the same!

Reference article:   https://blog.csdn.net/u010004317/article/details/82948040

Remote monitoring WAR package:

1 Set hostname -i private IP, if a virtual machine ip, you need to set the IP connection

vim / etc / hosts to add:

 

 

 2 catalina.sh modify files, set the startup parameters, in tomcat / bin directory:

 

 

 Adding JMX startup parameters:

CATALINA_OPTS="$CATALINA_OPTS -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.password.file=../conf/jmxremote.password
-Dcom.sun.management.jmxremote.access.file=../conf/jmxremote.access -Djava.rmi.server.hostname=公有IP"

3 server.xml add the listener port, that port connections:

 

 

 Add a listener port:

<Listener className="org.apache.catalina.mbeans.JmxRemoteLifecycleListener" rmiRegistryPortPlatform="6379" rmiServerPortPlatform="3306" />

4 copies jmxremote file permissions and edit

Here jdk11 jdk8 directory and is not the same, the jdk11 jdk-11.0.4 / conf / management / below, the copy path can be arranged just tomcat

Edit jmxremote.password:

Edit jmxremote.access:

 

 5 添加catalina-jmx-remote.jar:

Download: http://mvnrepository.com/artifact/org.apache.tomcat/tomcat-catalina-jmx-remote    I use 9.0.14, put tomcat / lib below, can be a normal start

Test 6 is connected with a user name or a default configuration

 

 

 

Note: If the connection fails, you can look at whether the port Telnet, and whether hostname -i Ip normal!

Remote monitoring JAR package: 

  Processing and file permissions as war package, jar directly followed by the start of the project can configure permissions, permission must be configured, as well as port configuration directly here:

java -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.password.file=~/jmxremote.password 
-Dcom.sun.management.jmxremote.access.file=~/jmxremote.access -Djava.rmi.server.hostname=47.93.1.227 -Dcom.sun.management.jmxremote.port=8011 -jar springmvc-0.0.1-SNAPSHOT.jar

 

Guess you like

Origin www.cnblogs.com/houzheng/p/11646771.html