JVM remote monitoring

jvm remote monitoring jstatd configuration

1. First configure the Java environment on the remote machine: JAVA_HOME, CLASSPATH, PATH
After the configuration is complete, pass: java -version and javac -version in cmd to confirm that the Java environment configuration is complete

2. Create a file: jstatd.all.policy (the name can be changed, the extension cannot be changed), the content is as follows:
	
       grant codebase "file:${java.home}/../lib/tools.jar" {
       permission java.security.AllPermission;
	};
   The role of this file is to enable the jstatd service to read the running data of the java application on the machine

3. Put this file in: %JAVA_HOME%\bin directory.

4. Open cmd, switch the directory to: %JAVA_HOME%\bin directory, and then execute the following command:
	
	jstatd -J-Djava.security.policy=jstatd.all.policy


5. If the client cannot connect to jstatd, try the following methods to see if the file can be resolved.
	(1) Use the hostname -i command to check whether the returned IP address is 127.0.0.1. If it is, it means that it is caused by other reasons, and there is no need to read further, otherwise, go to step 2.
	(2) Open the hosts file under /etc and change the "127.0.0.1 machine name" to "your machine's IP machine name".
	           For example: Change 127.0.0.1 ubuntuServer to 192.168.1.99 ubuntuServer
	(3) Restart the jstatd process.
	
	
jmx configuration

	cd $JAVA_HOME/jre/lib/management
	cp jmxremote.password.template jmxremote.password
	chmod -R 600 jmxremote.password
	
	Remove the comment mark from the permission section in jmxremote.password.
	# password "QED".  The "controlRole" role has password "R&D".
	#
	# monitorRole QED
	# controlRole   R&D
	change into:
	monitorRole QED
	controlRole   R&D
	
	Put the setenv.sh file into the bin directory of tomcat


-- tomcat7 remote debugging configuration

If the remote debugging cannot be completed using the following steps, please read the comments in the catalina.sh script directly, there will be instructions on how to configure jpda

The last sentence of bin/startup.sh is changed to exec "$PRGDIR"/"$EXECUTABLE" jpda start "$@"

Add the following two configurations to the top of bin/catalina.sh, you can make corresponding modifications according to the comments inside
		JPDA_ADDRESS=9999
		JPDA_SUSPEND=n
	
Use the command ./bin/startup.sh to start tomcat7 and check whether the startup log is normal
	
Use the command netstat -an | grep 9999 to check whether the port has started listening
	
Right-click on the project in Eclipse and select Debug As -> Debug Configurations. . . -> Remote Java Application -> Right click and select NEW
	Fill in the Host and Port in the pop-up window and click Debug.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326614172&siteId=291194637