• 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.
  • 相关阅读:
    Path 环境变量
    Scala_ 类_可见性
    ubuntu16.04 注意特别出
    Python基础之文件操作
    python之set集合操作
    python数据类型之字典操作
    python的数据类型之列表list
    Python的条件控制及循环
    使用jmeter做接口测试
    AMD64 专业名词缩写
  • 原文地址:https://www.cnblogs.com/robinunix/p/6125032.html
Copyright © 2020-2023  润新知