博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
jvisualvm监控远程服务器linux的tomcat
阅读量:4041 次
发布时间:2019-05-24

本文共 1356 字,大约阅读时间需要 4 分钟。

1.在tomcat的安装目录的bin文件夹的startup.sh的最后一行exec "$PRGDIR"/"$EXECUTABLE" start "$@" 之前加上下面的一段代码

 export CATALINA_OPTS="$CATALINA_OPTS
-Dcom.sun.management.jmxremote -Djava.rmi.server.hostname=118.194.246.76  -Dcom.sun.management.jmxremote.port=8999 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=true -Dcom.sun.management.jmxremote.password.file=/usr/local/tomcat80/conf/jmxremote.password  -Dcom.sun.management.jmxremote.access.file=/usr/local/tomcat80/conf/jmxremote.access"

参数说明:-Djava.rmi.server.hostname=xxx.xxx.xxx.xxx 主机地址,我配置的是外网地址

-Dcom.sun.management.jmxremote.port=xxx  端口号、配置完端口号之后需要将此端口开放出来  可以使用命令:iptables -A INPUT -p tcp --d port  端口号 -j ACCEPT
-Dcom.sun.management.jmxremote.authenticate=true 是否开启认证、false的时候可以不使用密码访问
-Dcom.sun.management.jmxremote.password.file=../conf/jmxremote.password -Dcom.sun.management.jmxremote.access.file=..

jmxremote相关文件在tomcat的conf目录创建

其中jmxremote.access文件的内容可以配置为:

username1 readonly
username2 readwrite

jmxremote.password文件可以配置为:
username1 password1
username2 password2
将以上俩文件放在对应配置目录tomcat/conf/下
并且将以上俩个文件访问权限配置成:
chmod 600 jmx*

2.注意localhost中配置的地址是否跟上面的hostname一致,可以使用命令hostname -i查看,如果现实127.0.0.1,则需要vi /etc/hosts文件,修改为上面步骤1中的hostname的值

3.步骤1中的port需要是防火墙允许的,iptables -A INPUT -p tcp --d port  端口号 -j ACCEPT  添加到防火墙允许范围,防火墙的关闭是 service iptables stop

4.本地window的jvisual工具便可以进行远程连接了。

你可能感兴趣的文章
通过C++反射实现C++与任意脚本(lua、js等)的交互(二)
查看>>
利用清华镜像站解决pip超时问题
查看>>
[leetcode BY python]1两数之和
查看>>
微信小程序开发全线记录
查看>>
PTA:一元多项式的加乘运算
查看>>
CCF 分蛋糕
查看>>
解决python2.7中UnicodeEncodeError
查看>>
小谈python 输出
查看>>
Django objects.all()、objects.get()与objects.filter()之间的区别介绍
查看>>
python:如何将excel文件转化成CSV格式
查看>>
机器学习实战之决策树(一)
查看>>
机器学习实战之决策树二
查看>>
[LeetCode By Python]7 Reverse Integer
查看>>
[leetCode By Python] 14. Longest Common Prefix
查看>>
[LeetCode By Python]118. Pascal's Triangle
查看>>
[LeetCode By Python]121. Best Time to Buy and Sell Stock
查看>>
[LeetCode By Python]122. Best Time to Buy and Sell Stock II
查看>>
[LeetCode By Python]125. Valid Palindrome
查看>>
[LeetCode By Python]136. Single Number
查看>>
[LeetCode By MYSQL] Combine Two Tables
查看>>