zoukankan      html  css  js  c++  java
  • tomcat Enabling JMX Remote

    wiki 利用JMX做存活监控

    cat /opt/wiki/work/bin/setenv.sh | grep jmxremote
    CATALINA_OPTS="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=8410 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Duser.timezone=Asia/Shanghai ${CATALINA_OPTS}"

    关于如何Enabling JMX Remote,参考如下:

    http://tomcat.apache.org/tomcat-5.5-doc/monitoring.html#Enabling_JMX_Remote

    The Sun website includes the list of options and how to configure JMX Remote on Java 5:http://java.sun.com/j2se/1.5.0/docs/guide/management/agent.html.

    For quick installation you find here a short installation guide:

    Add the following parameters to your Tomcat startup script:

        set CATALINA_OPTS=-Dcom.sun.management.jmxremote 
        -Dcom.sun.management.jmxremote.port=%my.jmx.port% 
        -Dcom.sun.management.jmxremote.ssl=false 
        -Dcom.sun.management.jmxremote.authenticate=false
        
    1. When you think authorization is a good, add and change this :
          -Dcom.sun.management.jmxremote.authenticate=true 
          -Dcom.sun.management.jmxremote.password.file=../conf/jmxremote.password 
          -Dcom.sun.management.jmxremote.access.file=../conf/jmxremote.access 
          
    2. edit the access allow file $CATALINA_BASE/conf/jmxremote.access :
      monitorRole readonly
      controlRole readwrite
          
    3. edit the password file $CATALINA_BASE/conf/jmxremote.password :
      monitorRole tomcat
      controlRole tomcat
          
      Tip: Password File must be readonly and not accessible from every other user! Remove all other users under windows to access this file.

    Note:The JSR 160 JMX-Adaptor opens a second data protocol port. That is a problem when you have installed a local firewall. However, there is at least one possible workaround: using a custom JMXConnectorServer.

    Start a JMX Adaptor with fix data port is supported with Tomcat 5.5.25 src release:

    <Server ...>
    ...
    <Listener className="org.apache.catalina.mbeans.JMXAdaptorLifecycleListener"
              namingPort="8083" port="8084" host="myhost" />  
    ...
    </Server>
       

    You can use all JMX system properties (com.sun.management.jmxremote.xxx) to configure the adaptor :-) 
    At your remote jconsole call the jmx adaptor with following command 
    jconsole service:jmx:rmi://myhost:8084/jndi/rmi://myhost:8083/server

    Activate JMX MX4J Http Adaptor with Java 1.4:

    1. Install the tomcat compat package
    2. Install the mx4j-tools.jar at common/lib. Please, use the same MX4j version as your Tomcat release
    3. Configure a MX4J JMX HTTP Adaptor at your AJP Connector
            <Connector port="${AJP.PORT}" 
                  handler.list="mx" 
                  mx.enabled="true" 
                  mx.httpHost="${JMX.HOST}"
                  mx.httpPort="${JMX.PORT}"
                  protocol="AJP/1.3" />
            

      Tip: With ${AJP.PORT}=0 no ajp connection where started.

      Note: MX4J JSR 160 RMI Adaptor to support JDK 1.4 currently not integrated.

    4. Start your Tomcat and look with a browser at http://${JMX.HOST}:${JMX.PORT}
    5. With the mx connector parameter mx.authMode="basic" mx.authUser="tomcat" mx.authPassword="strange" you can control the access!
    6. A complete list of all Tomcat core MBeans can you find at http://tomcat.apache.org/tomcat-5.5-doc/catalina/funcspecs/mbean-names.html.
  • 相关阅读:
    Windows下好用的git客户端--GitExtentions
    高分辨率下放大netbeans中的小图标
    小书匠使用手册
    win8 telnet VirtualBox中的redhat9
    win8安装新字体
    netbeans设置字体
    win7下Chrome有两个图标的解决方法
    【转】HDU-6035-Colorful Tree
    POJ1703--Find them, Catch them(种类并查集)
    KMP的妙用(利用next数组寻找字符串的循环节)
  • 原文地址:https://www.cnblogs.com/robinunix/p/6125032.html
Copyright © 2011-2022 走看看