Tomcat远程JMX配置

1.进入Tomcat安装目录下的bin文件夹,在文本编辑器下打开catalina.bat文件。

2.添加以下红色字体部分的配置(使用不需要鉴权的配置)

set JAVA_OPTS=%JAVA_OPTS% %LOGGING_MANAGER% -Dcom.sun.management.jmxremote.port=6969 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.util.logging.config.file="%CATALINA_BASE%\conf\logging.properties"

3.如果为免安装版Tomcat,并且想把Tomcat注册为服务,需要打开bin文件夹的TomcatXw.exe,进行入下配置

设置JMX参数

4.注册为服务的方式为,控制台(cmd)下打开bin文件夹,输入service.bat install,删除服务则输入service.bat remove。

5.在Jconsole中输入远程监控的地址,验证配置是否正确:service:jmx:rmi:///jndi/rmi://ip:port/jmxrmi,如下图:

Jconsole

连接成功则表明配置成功了!!!

5.Linux下的配置,打开catalina.sh,在

 # ----- Execute The Requested Command -----------------------------------------

该行之后添加以下内容:

if [ "$1" = "start" ] ; then
JAVA_OPTS="-Djava.rmi.server.hostname=192.168.79.76 -Dcom.sun.management.jmxremote.port=6901 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false"
fi

重新启动tomcat,用Jconsole测试是否配置成功

猜你喜欢

转载自627485408.iteye.com/blog/1930920
今日推荐