zoukankan      html  css  js  c++  java
  • tomcat 7 jmx配置访问

    方法一:
         修改 CALINA_HOME/bin/catalina.sh
         在开头加入 jvm及jmx配置
    方法二(推荐):
         在CALINA_HOME/bin/下添加新文件setenv.sh
         并在该文件中添加配置项
     
     
     配置项:
    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'
    
    注意实际不分行
    如果启时查看$CATALINA_HOME/logs/catalina.out 如果报错类似jmx unknown host,在说明需要在/etc/hosts中配置hosts: real_ip hosts_name
    
    
    
    在局域网有防火墙访问限制时,配置jmx时需要注意:
    
    例如服务器在linux 部分端口开放,而你想在windows 用jconsole监控服务器运行状况,当你开通一个端口并通过该端口访问,有可能会无法连接
    引用tomcat7官方文档:
    Note: The JSR 160 JMX-Adaptor opens a second data channel on a random port. That is a problem when you have a local firewall installed. To fix it, configure a JmxRemoteLifecycleListener, as described in listeners documentation.
    
    意思是在JSR 160中JMX-Adaptor将会在一个随机端口开启第二个通道,因此,事实上我们需要同时有两个端口的访问权限,但是其中一个又是随机的,解决方案采用tomcat的
    
    JMX Remote Lifecycle Listener:
    
    1. This listener requires catalina-jmx-remote.jar to be placed in $CATALINA_HOME/lib.
    
    2. configure $CATALINA_HOME/conf/server.xml:
    
       
       
    <Listener className="org.apache.catalina.mbeans.JmxRemoteLifecycleListener"
              rmiRegistryPortPlatform="10001" rmiServerPortPlatform="10002" />
    

    3.with the following system properties set (e.g. in setenv.sh):
      -Dcom.sun.management.jmxremote.password.file=$CATALINA_BASE/conf/jmxremote.password
      -Dcom.sun.management.jmxremote.access.file=$CATALINA_BASE/conf/jmxremote.access
      -Dcom.sun.management.jmxremote.ssl=false
      
    
    server.xml 中的 rmiRegistryPortPlatform 相当于com.sun.management.jmxremote.port,因此在setenv.sh中不要重复设置该端口不然会报错!
     jconsole中访问地址:
    service:jmx:rmi://<hostname>:10002/jndi/rmi://<hostname>:10001/jmxrmi 或者直接 <hostname>:10001
    详情请见官方文档:
      http://tomcat.apache.org/tomcat-7.0-doc/config/listeners.html#JMX_Remote_Lifecycle_Listener_-_org.apache.catalina.mbeans.JmxRemoteLifecycleListener

  • 相关阅读:
    winform制作自定义控件(入门)
    VB2012读取xml
    VB生成xml
    通宵疯狂积累VB.NET基础知识
    【转】vs2010下创建webservice
    React Native 快速入门之认识Props和State
    mac下 mysql / nginx 问题总汇
    Oracle例外定义
    mac os x 把reids nignx mongodb做成随机启动吧
    Oracle 记录
  • 原文地址:https://www.cnblogs.com/lifengyong/p/3677911.html
Copyright © 2011-2022 走看看