Jconsole is a monitoring tool that comes with the JDK and can be found in the Jdk/bin directory. It is used to connect a running local or remote JVM, monitor the resource consumption and performance of running Java applications, and draw a large number of graphs to provide a powerful visual interface. and its own server memory is very small, even can say almost no consumption, it is a good tool.
-------------jconsole Monitor the Tomcat-----------------------------on the remote Linux server
Environment:
Server side: Linux + jdk1.60 + Tomcat 7
Client: Windows + jdk1.6.0
1. Tomcat's bin/catalina.sh file on the Linux server,
In # OS specific support. $var _must_ is set to either true or false. After this line, add the following parameters:
In general, this is:
1.java_opts= "-xms256m-xmx512m-xss1024k-xx:permsize=128m-xx:maxpermsize=256m" java_opts= "- Dcom.sun.management.jmxremote.port=9008-dcom.sun.management.jmxremote.ssl=false- Dcom.sun.management.jmxremote.authenticate=false "
2, the Linux server executes the hostname-i command, if the display is 127.0.0.1, you need to modify the/etc/hosts file, otherwise jconsole cannot link.
# vi/etc/hosts, modify as follows:
The original value is: 127.0.0.1 localhost localhost.localdomain localhost
Modified to: Server's real IP address localhost localhost.localdomain localhost
3 Linux Server firewall, also to open the corresponding port.
4 Client:
1. Open the cmd window and enter Jconsole
2. Specify the connection parameters:
Remote host: The real IP address of the server
Port: 9008
5, add: Due to the configuration of the above file, when you stop Tomcat, will be due to the above configured port is occupied and can not be stopped. 2 Ways to solve:
(1) Use killall-9 java to kill all Java processes.
(2) Configure the Catalina_pid=pid in catalina.sh so that the above occupied ports are automatically killed during the stop Tomcat process.
-----------------jconsole Monitor the Tomcat-------------------------on a remote Windows Server
Modify the server Tomcat Bin/catalina.bat file in the following line:
REM Guess catalina_home if not defined
Set current_dir=%cd%
Add the following parameters:
1.set Java_opts=-dcom.sun.management.jmxremote.port=9008-dcom.sun.management.jmxremote.ssl=false- Dcom.sun.management.jmxremote.authenticate=false
Note the location you added:
Restart Server Tomcat
Open the cmd window, enter Jconsole, connect.
Jconsole remotely monitor Tomcat's JVM memory (Linux, Windows)