jconsole 查看虚拟机使用情况
1.在远程机的tomcat的catalina.sh中加入配置:
JAVA_OPTS="$JAVA_OPTS -Djava.rmi.server.hostname=192.168.0.101 -Dcom.sun.management.jmxremote"
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=/usr/lib/jvm/java-1.8.0.101-3.b13.el7_2.x86_64/jre/lib/management/jmxremote.password"
2.配置权限文件
[root@roybin]# cd /usr/lib/jvm/java-1.8.0.101-3.b13.el7_2.x86_64/jre/lib/management/
[root@roymanagement]# cp jmxremote.password.template jmxremote.password
[root@roymanagement]# vi jmxremote.password
monitorRole QED
controlRole roy
3.配置权限文件为600
4.[root@localhost management]# chmod 600 jmxremote.password jmxremote.access
5.注意防火墙配置端口12345
解释:
hostname : 连接的远程ip
port: 远程连接的端口号
用户名:controlRole
密码: roy