jconsole监控远程运行在centos上的spring boot程序

发布时间:2019-11-19 发布网站:脚本宝典
脚本宝典收集整理的这篇文章主要介绍了jconsole监控远程运行在centos上的spring boot程序脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。

1.定义环境变量

由于需要设置的java启动参数较多,故而将其设置到环境变量中,在/etc/PRofile 最后一行增加

export JAVA_OPTS='-Djava.rmi.server.hostname=192.105.90.192 -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=8888 -Dcom.sun.management.jmxremote.rmi.port=8888 -Dcom.sun.management.jmxremote.authenticate=true -Dcom.sun.management.jmxremote.ssl=false'

然后 source /etc/profile 是文件生效

2.修改权限文件

复制jmxremote.password.template,并重名为jmxremote.password

[root@localhost management]# cd /usr/lib/jvm/java-1.8.0-oPEnjdk-1.8.0.181-3.b13.el6_10.x86_64/jre/lib/management/ [root@localhost management]# ls jmxremote.access  jmxremote.password  jmxremote.password.template  management.properties  snmp.acl.template [root@localhost management]# cp jmxremote.password.template jmxremote.password [root@localhost management]# vim jmxremote.password

对于jmxremote.password,将其中的:

#monITorRole  QED #controlRole  R&D

的注释去掉,改为

monitorRole  QED controlRole  R&D

QED、R&D为密码,可以自己修改,monitorRole 、controlRole是定义在jmxremote.access中的权限角色,前者只可读,后者可读可写

3.然后配置权限文件为600

[root@localhost management]# chmod 600 jmxremote.password jmxremote.access

4.启动java程序

启动时我们就可以用

nohup java $JAVA_OPTS -jar spider-0.0.1-sNAPSHOT.jar  >nohup 2>&1 &

这个脚本启动java程序了。

查看端口监听情况

netstat -ntulp

jconsole监控远程运行在centos上的spring boot程序

5.jconsole远程连接

用上面配置的ip以及端口、账户(角色)、密码远程登录即可

jconsole监控远程运行在centos上的spring boot程序

脚本宝典总结

以上是脚本宝典为你收集整理的jconsole监控远程运行在centos上的spring boot程序全部内容,希望文章能够帮你解决jconsole监控远程运行在centos上的spring boot程序所遇到的问题。

如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。