Configuring JMX remote connections
1. Start configuration parameters
When you start jar, add the following configuration-Dcom.sun.management.jmxremote.port=5050 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Djava.rmi.server.hostname=192.168.94.23
Start Parameter Description
-Dcom.sun.management.jmxremote.port
: Configuring a remote server on unoccupied port-Dcom.sun.management.jmxremote.ssl=false
: Configuring JMX whether ssl enabled-Dcom.sun.management.jmxremote.authenticate=false
: Configure whether to start authentication JXM-Djava.rmi.server.hostname
: Configure the server IP
2. Configure jvisualvm
Adding remote host information, fill in the host name, port. Port is the top port startup parameter configuration.
Add JXM connection, click OK.
After successfully added, you can start a virtual machine monitor.
Note: JMX does not support viewing visual GC, jstatd need to monitor.
Configuring remote connection jstatd
1. Create a file jstatd.all.policy
grant codebase "file:/usr/local/jdk1.8.0_161/lib/tools.jar" {
permission java.security.AllPermission;
};
2. Start jstatd
jstatd -J-Djava.security.policy=jstatd.all.policy -J-Djava.rmi.server.hostname=192.168.94.23 -J-Djava.rmi.server.logCalls=true -J-Djava.net.preferIPv4Stack=true -p 5056
Start Parameter Description
-J-Djava.security.policy=jstatd.all.policy
Specify the file path jstatd.all.policy-J-Djava.rmi.server.logCalls=true
: Whether to print the log-J-Djava.rmi.server.hostname=192.168.19.114
: Configuration server address-p
: Port
3. Configure jvisualvm
Select the remote server, add jstatd right connection, fill in a port number, the port number to start jstatd above the specified port.
After successfully added, the server will show the list of all the applications on the Java virtual machine server. Depending on the application name or port number to select the monitored service to start monitoring. At this page you can find visual GC has been viewed.