昨夜西风凋碧树 独上高楼望尽天涯路。
邻近上线,居然才安装ActiveMQ,测试环境是在win环境下安装的,线上环境是Linux。
然而问题出现了,一直无法启动。
吓得我赶紧查了查看了一下日志:
cat data/cat activemq.log
有错误日志,显示无法连接数据库,继续跟踪底层代码扒拉,居然是缺少JAR包,不清楚他们是在win环境下怎么测试的。
于是 lib目录下加入 dbcp 连接池 commons-pool-1.6.jar 和commons-dbcp.jar 即可。
还有记得修改 地址默认是 0.0.0.0 最好更改为127.0.0.1 或者本机的内网IP地址,否则可能会出现其他问题。
<transportConnectors>
<!-- DOS protection, limit concurrent connections to 1000 and frame size to 100MB -->
<transportConnector name="openwire" uri="tcp://172.16.1.120:61616?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
<transportConnector name="amqp" uri="amqp://172.16.1.120:5672?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
<transportConnector name="stomp" uri="stomp://172.16.1.120:61613?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
<transportConnector name="mqtt" uri="mqtt://172.16.1.120:1883?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
<transportConnector name="ws" uri="ws://172.16.1.120:61614?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
</transportConnectors>
配置好后重启即可,如果遇到端口61616已经占用的情况,使用 netstat -nl|grep 61616 杀掉进程即可。
| ERROR | Failed to start ActiveMQ JMS Message Broker (localhost, null). Reason: Java.io.IOException: Transport
Connector could not be registered in JMX: Failed to bind to server socket: tcp://0.0.0.0:61616 due to: java.NET.BindException: Address already in use: JVM_Bind
访问密码在 conf/jetty-realm.properties 中
值得注意的是 用户名和密码的格式是 用户名 : 密码 ,角色名
访问地址 http://ip:8186/admin 输入密码即可。