Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The method of Jvisualvm Monitoring remote SpringBoot Project

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces the relevant knowledge of the method of Jvisualvm monitoring remote SpringBoot project, the content is detailed and easy to understand, the operation is simple and fast, and it has certain reference value. I believe you will get something after reading this article on the method of Jvisualvm monitoring remote SpringBoot project. Let's take a look at it.

Note: there are two ways for VisualVM to connect to a remote server: JMX and jstatd, neither of which perfectly supports all functions

For example, JMX does not support VisualGC

Jstatd does not support CPU monitoring

The actual use can be configured at the same time and selected as needed.

Jvisualvm program to add a remote connection, please turn off the local firewall.

JMX1. Modify SpringBoot startup parameters

The normal springboot startup command is

Nohup java-jar demo.jar &

After using monitoring:

Nohup java-Djava.rmi.server.hostname=192.168.81.149\-Dcom.sun.management.jmxremote\-Dcom.sun.management.jmxremote.port=1099\-Dcom.sun.management.jmxremote.authenticate=false\-Dcom.sun.management.jmxremote.ssl=false\-jar jvm-1.0-SNAPSHOT.jar & java-Djava.rmi.server.hostname=192.168.81.149\-Dcom.sun.management.jmxremote\-Dcom.sun.management.jmxremote.port=1099\-Dcom.sun.management.jmxremote.authenticate=false\-Dcom .sun.management.jmxremote.ssl = false\-jar jvm-1.0-SNAPSHOT.jar

Jvm-1.0-SNAPSHOT.jar is the jar package for the project

192.168.81.149 is the machine ip deployed by the project.

1099 is the remote port number to which jvisualvm needs to connect

Authenticate=false is not enabled, user authentication

two。 Use local jvisualvm to monitor remote

After opening it, there may be nothing, empty, this is because the project needs to be visited, whatever.

Jstatd1. Add configuration

This way you need to install JDK manually, or you know where jdk is.

Create the bin in the jdk directory

Vi jstatd.all.policy

I have designated an absolute path here to facilitate the elimination of the influence of the path.

Grant codebase "file:$ {java.home} /.. / lib/tools.jar" {permission java.security.AllPermission;}

Start the jstatd background application port (default is 1099) use the parameter-p to specify a different port

Jstatd-J-Djava.security.policy=jstatd.all.policy\-J-Djava.rmi.server.hostname=192.168.81.149\-J-Djava.rmi.server.logCalls=true-p 1098

(I am running the following command under the / usr/local/jdk1.8.0_161/bin path, where there is the jstatd.all.policy file. If it is executed elsewhere, remember to specify an absolute or relative path)

Among them

-J-Djava.security.policy=jstatd.all.policy specifies the path-J-Djava.rmi.server.logCalls=true prints the log-J-Djava.rmi.server.hostname=192.168.81.149 specifies the hostname, which should be consistent with the result you executed with the hostname-I command.

Start the project

Java-jar jvm-1.0-SNAPSHOT.jar2. Use local jvisualvm to monitor remote

This 1098 is actually automatically converted by 1098 when we type it.

This is the end of this article on "how Jvisualvm monitors remote SpringBoot projects". Thank you for reading! I believe you all have a certain understanding of the method of "Jvisualvm monitoring remote SpringBoot projects". If you want to learn more, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report