jconsole链接服务器调试配置方法
链接本地配置
jdk配置
-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=8089 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false
-------------------------------------------------------------------------------
远程配置方法
1. 修改catalina.sh 启动文件
修改位置
#JAVA_OPTS="$JAVA_OPTS -Dorg.apache.catalina.security.SecurityListener.UMASK=`umask`"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.port=12345"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.authenticate=true"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.ssl=false"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.pwd.file=/home/iedm/jdk1.7.0_80/jre/lib/management/jmxremote.password"
2. 配置权限文件
[[email protected] bin]# cd /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.101-3.b13.el7_2.x86_64/jre/lib/management/ [[email protected] management]# cp jmxremote.password.template jmxremote.password [[email protected] management]# vi jmxremote.password
开放这两个注释
monitorRole QED
controlRole 666
用户名:controlRole 密码:666
3.配置权限文件为600
[[email protected] management]
# chmod 600 jmxremote.password jmxremote.access
这样基本配置就结束了,下面说两个坑,第一个就是防火墙的问题,要开放指定端口的防火墙,
我这里配置的是12345端口,第二个是hostname的问题
1 |
[[email protected] lib] # vi /etc/hosts
|
请将127.0.0.1修改为本地真实的IP,我的服务器IP是192.168.34.6
参考文章:https://www.cnblogs.com/think-in-java/p/6138439.html
telnet 192.168.34.6 12345 可以测试端口可用不可用
Trying 192.168.34.6...
Connected to 192.168.34.6.
Escape character is '^]'.