ActiveMQ无法启动或无法进入8161

问题描述:

问题1: 刚装好activeMQ,启动后无法连接8161

问题2: ./activemq start后./activemq status显示ActiveMQ not running

maverick@Maverick bin % ./activemq start
INFO: Loading '/opt/homebrew/Cellar/activemq/5.16.3/libexec//bin/env'
INFO: Using java '/opt/homebrew/opt/openjdk/bin/java'
INFO: Starting - inspect logfiles specified in logging.properties and log4j.properties to get details
INFO: pidfile created : '/opt/homebrew/Cellar/activemq/5.16.3/libexec//data/activemq.pid' (pid '31160')
maverick@Maverick bin % ./activemq status
INFO: Loading '/opt/homebrew/Cellar/activemq/5.16.3/libexec//bin/env'
INFO: Using java '/opt/homebrew/opt/openjdk/bin/java'
ActiveMQ not running

原因分析:

问题一:active可以启动但连接不上8161

可能是因为 activemq/libexec/conf/jetty.xml内的ip设置有误

问题2:无法启动activeMQ

启动不了的原因有很多,我遇到的是端口被占用
ActiveMQ默认后台启动,不会默认把错误显示出来而是需要你
./activemq console
以前台启动来查看错误

关于端口占用问题

ActiveMQ不只是使用前端控制中心8161端口和61616端口,而是会占用
8161, 61616, 5672, 61613, 1883, 61614共6个端口
activemq/libexec/conf/activemq.xml内可以看到

<transportConnectors>
    <!-- DOS protection, limit concurrent connections to 1000 and frame size to 100MB -->
    <transportConnector name="openwire" uri="tcp://0.0.0.0:61616?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
    <transportConnector name="amqp" uri="amqp://0.0.0.0:5672?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
    <transportConnector name="stomp" uri="stomp://0.0.0.0:61613?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
    <transportConnector name="mqtt" uri="mqtt://0.0.0.0:1883?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
    <transportConnector name="ws" uri="ws://0.0.0.0:61614?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
</transportConnectors>

而我本机每次重启都会被占用61613,找到占用端口的进程,kill掉重启ActiveMQ就ok

解决方案:

问题1解决方案:

需要将activemq/libexec/conf/jetty.xml内的127.0.0.1改为0.0.0.0

<bean id="jettyPort" class="org.apache.activemq.web.WebConsolePort" init-method="start">
    <!-- the default port number for the web console -->
    <property name="host" value="0.0.0.0"/>
    <property name="port" value="8161"/>
</bean>

问题2解决方案:

找到占用以上6个端口的进程kill掉

maverick@Maverick conf % lsof -i tcp:8161
COMMAND   PID     USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
java    19144 maverick  148u  IPv6 0x1d3977c14786090b      0t0  TCP *:patrol-snmp (LISTEN)
maverick@Maverick conf % kill 19144

总结:

如遇到其他问题可使用 ./activemq console查看具体报错信息

  • 3
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值