Apache ActiveMQ 自带监控管理界面,浏览器activemq启动ip:8161即可,初始用户名密码为admin,admin;本文是想解决将activemq的监控添加到自己的项目中。
Apache官网配置和例子 (尽量确保自己使用的是较新版本的activemq)
本文运行环境是linux:
首先,编辑/apache/conf/activemq.xml:
<broker xmlns="http://activemq.org/config/1.0" brokerName="localhost"useJmx="true">
...
<managementContext>
<managementContext connectorPort="2011" jmxDomainName="test.domain" />
</managementContext>
...
</broker>
在<broker>标签中添加"useJmx"="true",<managementContext>标签中的connectorPort和jmxDomainName可以自己设置,不过要和其他配置保持一致,后面会说到。
然后,编辑/apache/bin/activemq(activemq为程序开启的入口,需要添加一些配置:
ACTIVEMQ_SUNJMX_START="-Dcom.sun.management.jmxremote.port=2011 "
ACTIVEMQ_SUNJMX_START="$ACTIVEMQ_SUNJMX_START -Dcom.sun.management.jmxremote.password.file=${ACTIVEMQ_CONF}/jmx.password"
ACTIVEMQ_SUNJMX_START="$ACTIVEMQ_SUNJMX_START -Dcom.sun.management.jmxremote.access.file=${ACTIVEMQ_CONF}/jmx.access"
ACTIVEMQ_SUNJMX_START="$ACTIVEMQ_SUNJMX_START -Dcom.sun.management.jmxremote.ssl=false"
注意