VisualVM JVM via JMX remote connections

 

If installed locally JDK, you in the $ {java.home} / bin / found jvisualvm.exe, to use a double-click. Otherwise, go to the official website to download a, decompression can be used. Springboot a conventional procedure springbootdemo.jar, using the JDK jvisualvm way of monitoring the JVM JMX

A query hostname

Second, check hostname ip address corresponding to

The following is a newly installed ip address corresponding to the virtual machine hostname

Third, the ip address of the current machine for external network access

The machine ip address is 192.168.102.31

 Fourth, corresponding to the hostname ip address is added to the / etc / hosts file

vim /etc/hosts

Add to

192.168.102.31 localhost.localdomain

Fifth, the program starts springboot

springbootdemo startup script as follows, JMX server main listening port number is set to 1566

#!/bin/bash

cd `dirname $0`
/usr/java/jdk1.8.0_162/bin/java -jar -Djava.rmi.server.hostname=192.168.102.31 -Dcom.sun.management.jmxremote.port=1566 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Xms100m -Xmx100m springbootdemo.jar &

 Sixth, open ports

If the firewall is switched off, then skip this step, if otherwise, the following steps

1, query the current process pid

ps -ef | grip spring boot demo

2, query the java program listening port

lsof -i | grep 38231

3, open the required ports (1566/44518/56989) in the firewall

Note that, in addition to JMX listening port number 1566 is fixed outside, every time you start the other two listening port number will change, you can use a script after starting to get the other two ports added to the firewall, and the shift in addition to random port to listen when the last boot

firewall-cmd --permanent --add-port=1566/tcp
firewall-cmd --permanent --add-port=44518/tcp
firewall-cmd --permanent --add-port=56989/tcp

4, restart the firewall to take effect

systemctl restart firewalld.service

5, view the results of open ports to confirm the setting success

firewall-cmd --list-all

Seven, VisualVM connects the JVM

1, after VisualVM opens, right-remote - the "Add Yuncheng host, enter the ip address to determine

2, the newly added host, right click JMX connection is added, the input port number

 

After clicking OK, the next record in the host below

Double-click to open

Configuring End

 

 

 

 

Guess you like

Origin www.cnblogs.com/qq931399960/p/10960573.html