JVM内存分析系列(十)jvisualVM和jConsole

jvm 启动参数

1 无用户名密码,多网卡,必须要制定hostname参数
-Dcom.sun.management.jmxremote.port=9999 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Djava.rmi.server.hostname=192.168.56.2

2 带用户名密码(参考资料http://www.iteye.com/topic/1117986)
-Dcom.sun.management.jmxremote.port=9999 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=true -Dcom.sun.management.jmxremote.password.file=/application/search/op-app-widget/visualVM/jmxremote.password -Dcom.sun.management.jmxremote.access.file=/application/search/op-app-widget/visualVM/jmxremote.access

给配置文件 chmod 600 *

jmxremote.password文件内容
root open

jmxremote.access文件内容
root readwrite

3 not supported for this JVM,jstatd参考文章http://blog.csdn.net/xsxxxsxx/article/details/7306636
官方文档 http://docs.oracle.com/javase/6/docs/technotes/tools/share/jstatd.html
服务器必须启动jstatd agent
要使用 VisualGC 必须在远程机上启动jstatd代理程序,否则会显示 “not supported for this jvm” 错误而启动 jstatd 时会有一个权限问题,需要做如下修改:
vi jstatd.all.policy

grant codebase "file:${java.home}/../lib/tools.jar" {
permission java.security.AllPermission;
};

启动命令,多网卡,必须要制定hostname参数
nohup jstatd -J-Djava.security.policy=/application/search/usr/apache-tomcat-7.0.47/conf/jstatd.all.policy -J-Djava.rmi.server.logCalls=true -J-Djava.rmi.server.hostname=192.168.56.2 -p 10000 &

其中 -p 为端口,在visualVM中,如果使用默认端口,则会自动加载jstatd的远程,如果使用了其他端口,就需要手动添加

【Q&A】
java.net.UnknownHostException:chinaso异常处理
将真实IP映射到HOSTNAME上
具体修改/etc/hosts文件
192.168.56.2   chinaso
启动参数中,添加-Djava.rmi.server.hostname=192.168.56.2

猜你喜欢

转载自phl.iteye.com/blog/1991841
今日推荐