activeMQ JMS监控配置

一、配置activeMQ
切换至 activemq解压目录/conf/
1、修改conf/中的activemq.xml,如下
    <broker xmlns="http://activemq.org/config/1.0" brokerName="localhost" useJmx="true">  
      
      ...  
      
      <managementContext>  
         <managementContext createConnector="false"/>  
      </managementContext>  
      
      ...  
      
    </broker>  


useJmx="true" : 启用JMX
createConnector="false" : 不自创建连接


2、修改jmx.access和jmx.password,配置添加JMS登陆用户和密码
jmx.access
# The "monitorRole" role has readonly access.  
# The "controlRole" role has readwrite access.  
monitorRole readonly  
controlRole readwrite 


jmx.password
# The "monitorRole" role has password "abc123".   
# The "controlRole" role has password "abcd1234".  
monitorRole abc123  
controlRole abcd1234  


3、打开activemq解压目录/bin/activemq.bat 编辑,将:
if "%SUNJMX%" == "" set SUNJMX=-Dcom.sun.management.jmxremote
REM set SUNJMX=-Dcom.sun.management.jmxremote.port=1099 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false


修改为:
if "%SUNJMX%" == "" set SUNJMX=-Dcom.sun.management.jmxremote.port=11099 -Dcom.sun.management.jmxremote.authenticate=true -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.password.file=%ACTIVEMQ_BASE%/conf/jmx.password -Dcom.sun.management.jmxremote.access.file=%ACTIVEMQ_BASE%/conf/jmx.access
REM set SUNJMX=-Dcom.sun.management.jmxremote


注:开启远端JMX端口11099,这里的端口与activemq.xml里面配置的jmx端口号(默认是1099)不能重复。

至此jms监控配置完毕

4、重启activemq
如启动activemq时,窗口一闪就显示了,当获取到如下异常:
错误:必须限制口令文件读取访问权限: D:\work\apache-activemq-5.6.0\bin\../conf/jmx.password


解决方法:运行cmd 切换至 activemq解压目录/conf ,运行如下命令,修改访问权限:
cacls ../conf/jmx.password /P Administrators:R
cacls ../conf/jmx.access /P Administrators:R

当提示时,输入Y

至此完毕,重启activemq

你可能感兴趣的:(jms,activemq)