标签:openjdk control nbsp img jdk 进程 amp java_home template
1.安装openjdk
centos:yum install java-1.8.0-openjdk java-1.8.0-openjdk-devel
2.
# cd /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.31-1.b13.el6_6.x86_64/jre/lib/management/ # cp jmxremote.password.template jmxremote.password # chmod 644 jmxremote.password # vi jmxremote.password monitorRole QED controlRole R&D
3.jstatd以守护进程启动
# jstatd -J-Djava.rmi.server.hostname=172.28.37.200 & [1] 8601 # Could not create remote object access denied ("java.util.PropertyPermission" "java.rmi.server.ignoreSubClasses" "write") java.security.AccessControlException: access denied ("java.util.PropertyPermission" "java.rmi.server.ignoreSubClasses" "write") at java.security.AccessControlContext.checkPermission(AccessControlContext.java:472) at java.security.AccessController.checkPermission(AccessController.java:884) at java.lang.SecurityManager.checkPermission(SecurityManager.java:549) at java.lang.System.setProperty(System.java:792) at sun.tools.jstatd.Jstatd.main(Jstatd.java:139)
解决:
#cd /home/jdk-1.8/bin #vim jstatd.all.policy grant codebase "file:${java.home}/../lib/tools.jar" { permission java.security.AllPermission; };
#jstatd -J-Djava.security.policy=jstatd.all.policy -J-Djava.rmi.server.hostname=172.28.37.200 &
[1] 10008
4.在windows的java_home/bin下,打开jvisualvm.exe
如图,显示CPU不受JVM支持,需要建立jvm链接
tomcat下,修改、增加JVM参数
# cd /root/apache-tomcat-8.0.17/bin # vi catalina.sh #找到JAVA_OPTS,在下面添加,添加的位置并没要要求
JAVA_OPTS="$JAVA_OPTS-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9999 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=172.28.37.200" # ./startup.sh # netstat -antp |grep 9999 #查看端口是否监听
dubbo服务,修改或增加JVM参数
# vim service.sh
JAVA_OPTS="$JAVA_OPTS-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=9999 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=172.28.37.200"
重启后查看端口监听
# netstat -antp |grep 9999 #查看端口是否监听
重启后,CPU监控已出现
标签:openjdk control nbsp img jdk 进程 amp java_home template
原文地址:https://www.cnblogs.com/xiaowei89426/p/9347949.html