Remote monitoring of JBoss application Java memory configuration (measured)

Source: Internet
Author: User
Tags jboss jboss server jconsole

Objective

Because the recent deployment of a project on the client side of the one-month run will be the problem of Java memory overflow, in order to constantly monitor the situation of Java memory needs, the need to remotely view the Java memory on the server some of the situation. When the company simulates deploying a project running under Remote monitoring Linux.

A brief introduction of two jdk1.6 visual monitoring tools
jconsole: Java 6.x uses JMX to provide a series of APIs for monitoring and managing virtual machines, and Jconsole, published with the SDK, uses these APIs to implement the tools used to monitor virtual machines. Jconsole can provide the memory, thread, class loading and mbean information of the virtual machine, which can monitor the operation of the server in real time.

JVISUALVM: Is the NetBeans profile project, which has been brought in JDK6.0 update 7 (Java startup requires no specific parameters, monitoring tools in bin/jvisualvm.exe) to monitor threads, memory, View the CPU time of the method and the object in memory, the object of the GC, and reverse-view the allocated stack (such as the 100 string objects that are assigned to each of these objects).

Second, if the win series of computers to view the memory of the computer, directly locate the JDK installation path Double-click the Visual monitoring tool mentioned above

Third, if you want to monitor remote Java memory, you need to do some of the appropriate configuration to run the environment
Server: Redhat6.0 + JDK 1.6+ Jboss 5.1
IP Address: 192.168.1.250
Client: Windows + JDK 1.6

2. Parameter configuration without username password (very simple), only need to modify the run.sh under the bin in JBoss. Add the Red writing section to the bottom of the sentence.

java_opts= "-dprogram.name= $PROGNAME $JAVA _opts"
java_opts= "$JAVA _opts-dcom.sun.management.jmxremote.port=9999"
java_opts= "$JAVA _opts-dcom.sun.management.jmxremote.authenticate=false"
java_opts= "$JAVA _opts-dcom.sun.management.jmxremote.ssl=false"
java_opts= "$JAVA _opts-djava.rmi.server.hostname=192.168.1.250"

Attention:
1, 9999 indicates the monitored port number to ensure that the specified ports are not occupied;
2, you can use Netstat-an to view the ports already occupied;
3, with Lsof-i:portnum to view the specific application of the port occupation;
4, in addition, if the Firewall service is opened, please ensure that the port can access through the firewall;

5, 192.168.1.250 for the current server IP;

3. Start JBoss Server


./run.sh-b 192.168.1.250 & must specify the address of the JBoss server binding through the-B parameter;
Allow all user connections to-B 0.0.0.0

4, connect the remote virtual machine

Start the jconsole in the native%java_home%\bin directory,
In the "Remote process:" Column of the pop-up dialog box, type 192.168.1.250:9999, and then tap Connect, as shown in the following image:

Attach: Parameter configuration with username password

First, modify the run.sh under the bin in JBoss. Add a section of red handwriting to the bottom of the sentence

java_opts= "-dprogram.name= $PROGNAME $JAVA _opts"
java_opts= "$JAVA _opts-dcom.sun.management.jmxremote.port=9999"
java_opts= "$JAVA _opts-dcom.sun.management.jmxremote.authenticate=true"
java_opts= "$JAVA _opts-dcom.sun.management.jmxremote.ssl=false"
java_opts= "$JAVA _opts-djava.rmi.server.hostname=192.168.1.250"
java_opts= "$JAVA _opts-dcom.sun.management.jmxremote.password.file=/usr/java/jdk1.6/jre/lib/management/ Jmxremote.password "

Note that the Jmxremote.password in the $JAVA _home/jre/lib/management/jmxremote.password is copied by the original jmxremote.password.template,

Remove Monitorrole in front of the # If you do not modify the login username: monitorrole Password: QED (You can modify the user name password as needed, but if you want to change the same

is the right to modify the corresponding name in the Jmxremote.access

Second, if this problem or error occurs during the startup process

is because the Jmxremote.password permission issue is executed under the file path: chmod jmxremote.password

Start the project again with 3.

Four, for JVISUALVM in the tree structure of remote IP Add, and then right the IP Add JMX link Add the top number and user name password can link success, as shown in the figure:




Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.