在进行activemq的安装中,碰到的坑,这里记录一下。

环境:linux虚拟机

           activemq  5.16.0

根据官网的步骤下载安装,然后./activemq start启动。在windows访问控制台访问不了。

查看日志,

[root@mina1 apache-activemq-5.16.0]# cd data/

如下所示:

[root@mina1 data]# tail -f activemq.log 
2020-08-12 10:27:28,191 | INFO  | Creating Jetty connector | org.apache.activemq.transport
.WebTransportServerSupport | main2020-08-12 10:27:28,691 | WARN  | ServletContext@o.e.j.s.ServletContextHandler@388526fb{/,
null,STARTING} has uncovered http methods for path: / | org.eclipse.jetty.security.SecurityHandler | main2020-08-12 10:27:28,802 | INFO  | Listening for connections at ws://mina1:61614?maximumCon
nections=1000&wireFormat.maxFrameSize=104857600 | org.apache.activemq.transport.ws.WSTransportServer | main2020-08-12 10:27:28,804 | INFO  | Connector ws started | org.apache.activemq.broker.Transp
ortConnector | main2020-08-12 10:27:28,809 | INFO  | Apache ActiveMQ 5.16.0 (localhost, ID:mina1-43900-159719
9247592-0:1) started | org.apache.activemq.broker.BrokerService | main2020-08-12 10:27:28,814 | INFO  | For help or more information please see: http://activemq
.apache.org | org.apache.activemq.broker.BrokerService | main2020-08-12 10:27:28,817 | WARN  | Store limit is 102400 mb (current store usage is 0 mb). 
The data directory: /myactivemq/apache-activemq-5.16.0/data/kahadb only has 11439 mb of usable space. - resetting to maximum available disk space: 11439 mb | org.apache.activemq.broker.BrokerService | main2020-08-12 10:27:28,818 | WARN  | Temporary Store limit is 51200 mb (current store usage i
s 0 mb). The data directory: /myactivemq/apache-activemq-5.16.0/data only has 11439 mb of usable space. - resetting to maximum available disk space: 11439 mb | org.apache.activemq.broker.BrokerService | main2020-08-12 10:27:31,522 | INFO  | ActiveMQ WebConsole available at http://127.0.0.1:8161/ 
| org.apache.activemq.web.WebConsoleStarter | main2020-08-12 10:27:31,525 | INFO  | ActiveMQ Jolokia REST API available at http://127.0.0.1:
8161/api/jolokia/ | org.apache.activemq.web.WebConsoleStarter | main

这里出现警告的意思是。我配置的最大内存超过我的内存最大值。所以我们需要将它改小一点。

更改的文件在conf中的activemq.xml.

 <!--
            The systemUsage controls the maximum amount of space the broker will
            use before disabling caching and/or slowing down producers. For more information, see:
            http://activemq.apache.org/producer-flow-control.html
          -->
          <systemUsage>
            <systemUsage>
                <memoryUsage>
                    <memoryUsage percentOfJvmHeap="70" />
                </memoryUsage>
                <storeUsage>
                    <storeUsage limit="500 mb"/>
                </storeUsage>
                <tempUsage>
                    <tempUsage limit="300 mb"/>
                </tempUsage>
            </systemUsage>
        </systemUsage>

我这里改的比较小。然后重新启动,以上警告没有。但是访问仍然访问不了。

查看了下端口占用情况:

netstat -tnlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name   
tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN      1088/sshd           
tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN      1164/master         
tcp        0      0 127.0.0.1:6010              0.0.0.0:*                   LISTEN      1206/sshd           
tcp        0      0 :::61613                    :::*                        LISTEN      1902/java           
tcp        0      0 :::61614                    :::*                        LISTEN      1902/java           
tcp        0      0 :::61616                    :::*                        LISTEN      1902/java           
tcp        0      0 :::22                       :::*                        LISTEN      1088/sshd           
tcp        0      0 ::1:25                      :::*                        LISTEN      1164/master         
tcp        0      0 ::1:6010                    :::*                        LISTEN      1206/sshd           
tcp        0      0 :::1883                     :::*                        LISTEN      1902/java           
tcp        0      0 :::60508                    :::*                        LISTEN      1902/java           
tcp        0      0 ::ffff:127.0.0.1:8161       :::*                        LISTEN      1902/java           
tcp        0      0 :::5672                     :::*                        LISTEN      1902/java 

发现8161是正常的。但是访问还是出现以下界面。

在网上找了一圈,各种解决办法。都试了一遍。还是没有解决我访问不到控制台的问题。

然后我又查看了一下启动日志:

[root@mina1 data]# tail -f activemq.log 
2020-08-12 10:49:51,751 | INFO  | Connector mqtt started | org.apache.activemq.broker.TransportConnector | main
2020-08-12 10:49:51,765 | INFO  | Starting Jetty server | org.apache.activemq.transport.WebTransportServerSupport | main
2020-08-12 10:49:52,057 | INFO  | Creating Jetty connector | org.apache.activemq.transport.WebTransportServerSupport | main
2020-08-12 10:49:52,536 | WARN  | ServletContext@o.e.j.s.ServletContextHandler@388526fb{/,null,STARTING} has uncovered http methods for path: / | org.eclipse.jetty.security.SecurityHandler | 
main2020-08-12 10:49:52,751 | INFO  | Listening for connections at ws://mina1:61614?maximumConnections=1000&wireFormat.maxFrameSize=104857600 | org.apache.activemq.transport.ws.WSTransportServer 
| main2020-08-12 10:49:52,754 | INFO  | Connector ws started | org.apache.activemq.broker.TransportConnector | main
2020-08-12 10:49:52,755 | INFO  | Apache ActiveMQ 5.16.0 (localhost, ID:mina1-48914-1597200591540-0:1) started | org.apache.activemq.broker.BrokerService | main
2020-08-12 10:49:52,757 | INFO  | For help or more information please see: http://activemq.apache.org | org.apache.activemq.broker.BrokerService | main
2020-08-12 10:49:55,375 | INFO  | ActiveMQ WebConsole available at http://127.0.0.1:8161/ | org.apache.activemq.web.WebConsoleStarter | main
2020-08-12 10:49:55,375 | INFO  | ActiveMQ Jolokia REST API available at http://127.0.0.1:8161/api/jolokia/ | org.apache.activemq.web.WebConsoleStarter | main

发现访问127.0.0.1:8161是可以访问的,就是本地访问是能访问到的。但是怎么才可以外网访问呢。最后查了下配置ip 的文件,在nettey.xml中将127.0.0.1改为本机的ip地址。然后重启。查看日志:

会发现访问的地址改为ip地址加端口号。这时再访问客户端出现你想要的界面:

至此:问题解决完成。如有帮助,请点个赞。

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐