`

使用jconsole远程监控linux下tomcat使用情况

阅读更多

启动tomcat/bin/startup.sh中增加一下变量:

CATALINA_OPTS = " -Djava.rmi.server.hostname=192.168.1.69 \
                - Dcom.sun.management.jmxremote \
               
- Dcom.sun.management.jmxremote.port = 10900  \
               
- Dcom.sun.management.jmxremote.ssl = false  \
               
- Dcom.sun.management.jmxremote.authenticate = false "
export CATALINA_OPTS

 

其中-Djava.rmi.server.hostname项必须设置,否则远程连接会因为解析到127.0.0.1失败,该项的值就是你在windows客户端连接linux时的ip地址

接下来的端口要设置合适,不要与其他应用冲突

ssl和authenticate先设置为false,如果需要安全,请不要false

在客户端jdk1.5下就可以运行

jconsole 192.168.1.69:10900了

 

如果需要密码验证设置如下,以Red5的设置为例:

exec $JAVA -XX:+UseConcMarkSweepGC -Djava.security.manager -Djava.rmi.server.hostname=192.168.1.69 -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=10900 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.password.file=jmxremote.password -Dcom.sun.management.jmxremote.ssl=false -Djava.security.policy=conf/red5.policy -cp red5.jar:conf:$CLASSPATH org.red5.server.Standalone

 

在red5的安装目录下创建下列文件:

jmxremote.password

内容:

monitorRole QED
controlRole R&D

 登录JConsole就可以用用户名和密码:monitorRole/QED 登录JConsole了

 

参考资料:

http://download.oracle.com/javase/6/docs/technotes/guides/management/agent.html

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics