温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

Oracle JRockit Mission Control

发布时间:2020-06-20 21:10:09 来源:网络 阅读:392 作者:caidui 栏目:关系型数据库

用于分析jrockit虚拟机性能,可以实时监控性能,分析内存使用等等,现在的版本上面有很详细的帮助,还TMD中文的,感谢甲骨文。
服务器端配置简单,就是配置JMX
1.准备访问控制的.access和.password文件

mkdir -p /etc/jre_accesscp $JAVA_HOME/jre/lib/management/jmxremote.password.template /etc/jre_access/jmxremote.passwordcp $JAVA_HOME/jre/lib/management/jmxremote.access /etc/jre_access/jmxremote.accessvi /etc/jre_access/jmxremote.password# ...# monitorRole  QED# controlRole   R&Dusername   userpasswd
 vi /etc/jre_access/jmxremote.access##monitorRole   readonly#controlRole   readwrite \#              create javax.management.monitor.*,javax.management.timer.* \#              unregisterusername  readwrite
 chmod 600 /etc/jre_access/jmxremote.passwordchmod 644 /etc/jre_access/jmxremote.access

2.添加 启动jmx类

#jport=开启的监控端口#SERVERIP=服务所在服务器IP$JAVA_HOME/bin/java -Dcom.sun.management.jmxremote.port=$jport -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=true -Dcom.sun.management.jmxremote.access.file=/etc/jre_access/jmxremote.access -Dcom.sun.management.jmxremote.password.file=/etc/jre_access/jmxremote.password -Djava.rmi.server.hostname=$SERVERIP ...#接JAVA项目参数

3.tomcat添加JMX监控
和java项目差不多,采用的是yum安装的Tomcat/7.0.39
直接贴到tomcat7.conf里的JAVA_OPTS里面能够启动,但关闭蛋疼不能用,去掉参数就可以关闭
无奈把tomcat7.conf换成两份tomcat7_start.conf,tomcat7_stop.conf,并修改/etc/init.d/tomcat7

#---------#贴代码#---------cp /etc/tomcat7/tomcat7.conf /etc/tomcat7/tomcat7_start.confcp /etc/tomcat7/tomcat7.conf /etc/tomcat7/tomcat7_stop.conf
 vi /etc/tomcat7/tomcat7_start.conf# 添加如下内容..JAVA_OPTS="$JAVA_OPTS -verbosegc -Dcom.sun.management.jmxremote.port=7091 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=true -Dcom.sun.management.jmxremote.access.file=/etc/jre_access/jmxremote.access -Dcom.sun.management.jmxremote.password.file=/etc/jre_access/jmxremote.password  -Djava.rmi.server.hostname=218.58.x.x " vi /etc/init.d/tomcat7# 修改TOMCAT_CFG部分# Get the tomcat config (use this for environment specific settings)TOMCAT_CFG_start="/etc/tomcat7/tomcat7_start.conf"if [ -r "$TOMCAT_CFG_start" ]; then
    . $TOMCAT_CFG_startfi TOMCAT_CFG_stop="/etc/tomcat7/tomcat7_stop.conf"if [ -r "$TOMCAT_CFG_stop" ]; then
    . $TOMCAT_CFG_stopfi # 修改function parseOptions()function parseOptions_start() {
    options=""
    options="$options $(
                 awk '!/^#/ && !/^$/ { ORS=" "; print "export ", $0, ";" }' \                 $TOMCAT_CFG_start
             )"
    if [ -r "/etc/sysconfig/${NAME}" ]; then
        options="$options $(
                     awk '!/^#/ && !/^$/ { ORS=" ";
                                           print "export ", $0, ";" }' \                     /etc/sysconfig/${NAME}
                 )"
    fi
    TOMCAT_SCRIPT="$options ${TOMCAT_SCRIPT}"} function parseOptions_stop() {
    options=""
    options="$options $(
                 awk '!/^#/ && !/^$/ { ORS=" "; print "export ", $0, ";" }' \                 $TOMCAT_CFG_stop
             )"
    if [ -r "/etc/sysconfig/${NAME}" ]; then
        options="$options $(
                     awk '!/^#/ && !/^$/ { ORS=" ";
                                           print "export ", $0, ";" }' \                     /etc/sysconfig/${NAME}
                 )"
    fi
    TOMCAT_SCRIPT="$options ${TOMCAT_SCRIPT}"} #修改function start和stop内调用的parseOptionsfunction start() {...
    parseOptions_start
...} function stop() {...
    parseOptions_stop
...} #修改stop参数,执行两次
    stop)
        stop >> /dev/null 2>&1
        stop        ;;

这样客户端就可以通过Oracle JRockit Mission Control 连接监控JVM项目
本回完


向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI