您好,登錄后才能下訂單哦!
用于分析jrockit虛擬機(jī)性能,可以實(shí)時(shí)監(jiān)控性能,分析內(nèi)存使用等等,現(xiàn)在的版本上面有很詳細(xì)的幫助,還TMD中文的,感謝甲骨文。
服務(wù)器端配置簡單,就是配置JMX
1.準(zhǔn)備訪問控制的.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.添加 啟動(dòng)jmx類
#jport=開啟的監(jiān)控端口#SERVERIP=服務(wù)所在服務(wù)器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項(xiàng)目參數(shù) |
3.tomcat添加JMX監(jiān)控
和java項(xiàng)目差不多,采用的是yum安裝的Tomcat/7.0.39
直接貼到tomcat7.conf里的JAVA_OPTS里面能夠啟動(dòng),但關(guān)閉蛋疼不能用,去掉參數(shù)就可以關(guān)閉
無奈把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# 添加如下內(nèi)容..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內(nèi)調(diào)用的parseOptionsfunction start() {... parseOptions_start ...} function stop() {... parseOptions_stop ...} #修改stop參數(shù),執(zhí)行兩次 stop) stop >> /dev/null 2>&1 stop ;; |
這樣客戶端就可以通過Oracle JRockit Mission Control 連接監(jiān)控JVM項(xiàng)目
本回完
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請(qǐng)聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。