机器迁移后,启动activemq报错如下:
2014-06-12 11:50:23,848 | INFO | Connector amqp Started | org.apache.activemq.broker.TransportConnector | main
2014-06-12 11:50:23,849 | INFO | Apache ActiveMQ 5.8.0 (amq-broker, ID:localhost.localdomain-53393-1402545023572-0:1) started | org.apache.activemq.broker.BrokerService | main
2014-06-12 11:50:23,849 | INFO | For help or more information please see: http://activemq.apache.org | org.apache.activemq.broker.BrokerService | main
2014-06-12 11:50:24,347 | INFO | Web console type: embedded | org.apache.activemq.web.WebConsoleStarter | main
2014-06-12 11:50:24,475 | INFO | ActiveMQ WebConsole initialized. | org.apache.activemq.web.WebConsoleStarter | main
2014-06-12 11:50:24,530 | INFO | Initializing Spring FrameworkServlet 'dispatcher' | /admin | main
2014-06-12 11:50:24,724 | INFO | jolokia-agent: No access restrictor found at classpath:/jolokia-access.xml, access to all MBeans is allowed | /api | main
2014-06-12 11:50:32,041 | WARN | Failed to start jmx connector: Cannot bind to URL [rmi://localhost:3049/jmxrmi]: javax.naming.ServiceUnavailableException [Root exception is java.rmi.ConnectException: Connection refused to host: localhost; nested exception is:
java.net.ConnectException: Connection timed out]. Will restart management to re-create jmx connector, trying to remedy this issue. | org.apache.activemq.broker.jmx.ManagementContext | JMX connector
同时在停止mq的时候也会报错如下:
[root@localhost data]# ../bin/activemq stop
INFO: Using default configuration
(you can configure options in one of these file: /etc/default/activemq /root/.activemqrc)
INFO: Invoke the following command to create a configuration file
../bin/activemq setup [ /etc/default/activemq | /root/.activemqrc ]
INFO: Using java '/usr/local/jdk1.6.0_30//bin/java'
INFO: Waiting at least 30 seconds for regular process termination of pid '8500' :
Java Runtime: Sun Microsystems Inc. 1.6.0_30 /usr/local/jdk1.6.0_30/jre
Heap sizes: current=1004928k free=999683k max=1004928k
JVM args: -Xms1G -Xmx1G -Djava.util.logging.config.file=logging.properties -Dactivemq.classpath=/usr/local/apache-activemq-5.8.0/conf; -Dactivemq.home=/usr/local/apache-activemq-5.8.0 -Dactivemq.base=/usr/local/apache-activemq-5.8.0 -Dactivemq.conf=/usr/local/apache-activemq-5.8.0/conf -Dactivemq.data=/usr/local/apache-activemq-5.8.0/data
Extensions classpath:
[/usr/local/apache-activemq-5.8.0/lib,/usr/local/apache-activemq-5.8.0/lib/camel,/usr/local/apache-activemq-5.8.0/lib/optional,/usr/local/apache-activemq-5.8.0/lib/web,/usr/local/apache-activemq-5.8.0/lib/extra]
ACTIVEMQ_HOME: /usr/local/apache-activemq-5.8.0
ACTIVEMQ_BASE: /usr/local/apache-activemq-5.8.0
ACTIVEMQ_CONF: /usr/local/apache-activemq-5.8.0/conf
ACTIVEMQ_DATA: /usr/local/apache-activemq-5.8.0/data
Connecting to pid: 8500
..................ERROR: java.lang.RuntimeException: Failed to execute stop task. Reason: java.rmi.ConnectException: Connection refused to host: 10.0.30.221; nested exception is:
java.net.ConnectException: Connection timed out
java.lang.RuntimeException: Failed to execute stop task. Reason: java.rmi.ConnectException: Connection refused to host: 10.0.30.221; nested exception is:
java.net.ConnectException: Connection timed out
at org.apache.activemq.console.command.ShutdownCommand.runTask(ShutdownCommand.java:116)
at org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:57)
at org.apache.activemq.console.command.AbstractJmxCommand.execute(AbstractJmxCommand.java:387)
at org.apache.activemq.console.command.ShellCommand.runTask(ShellCommand.java:150)
at org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:57)
at org.apache.activemq.console.command.ShellCommand.main(ShellCommand.java:104)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.activemq.console.Main.runTaskClass(Main.java:262)
at org.apache.activemq.console.Main.main(Main.java:115)
从上面的情况可以看出在绑定地址上出现问题,修改方案如下:
--检查防火墙是否对端口有限制
telnet localhost 3049
--查看hosts绑定的localhost对应的ip
cat /etc/hosts
--修改ip绑定
vim /etc/hosts
[public@TESTLSPDTS001 data]$ tail -f activemq.log
2014-06-16 17:50:04,734 | WARN | Transport Connection to: tcp://172.17.206.138:53776 failed: java.io.EOFException | org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ Transport: tcp:///172.17.206.138:53776@3046
2014-06-16 18:28:28,797 | WARN | Transport Connection to: tcp://172.17.206.138:53860 failed: java.io.EOFException | org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ Transport: tcp:///172.17.206.138:53860@3046
2014-06-17 09:01:40,923 | WARN | Transport Connection to: tcp://172.17.206.138:54418 failed: java.io.EOFException | org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ Transport: tcp:///172.17.206.138:54418@3046
2014-06-17 09:02:51,360 | WARN | Transport Connection to: tcp://172.17.206.138:55314 failed: java.net.SocketException: Connection reset | org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ Transport: tcp:///172.17.206.138:55314@3046
2014-06-17 09:19:07,376 | WARN | Transport Connection to: tcp://172.17.206.138:55394 failed: java.io.EOFException | org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ Transport: tcp:///172.17.206.138:55394@3046
2014-06-17 09:20:01,210 | WARN | Transport Connection to: tcp://172.17.206.138:55605 failed: java.io.EOFException | org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ Transport: tcp:///172.17.206.138:55605@3046
2014-06-17 09:23:48,189 | WARN | Transport Connection to: tcp://172.17.206.138:55658 failed: java.io.EOFException | org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ Transport: tcp:///172.17.206.138:55658@3046
2014-06-17 09:24:51,476 | WARN | Transport Connection to: tcp://172.17.206.138:55741 failed: java.net.SocketException: Connection reset | org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ Transport: tcp:///172.17.206.138:55741@3046
2014-06-17 09:46:35,348 | WARN | Transport Connection to: tcp://172.17.206.138:55826 failed: java.io.EOFException | org.apache.activemq.broker.TransportConnection.Transport | ActiveMQ Transport: tcp:///172.17.206.138:55826@3046
<span style="color: rgb(54, 46, 43); font-family: Arial; font-size: 14px; line-height: 26px;">上面报错的原因:MQ配置文件里配置了ProducerFlowControl='true',而且memorylimit过小导致的
</span><policyEntry queue="com.yougou.logistics.dts.>" queuePrefetch="1" producerFlowControl="true" memoryLimit="64mb">
<pendingQueuePolicy>
<fileQueueCursor/>
</pendingQueuePolicy>
<deadLetterStrategy>
<individualDeadLetterStrategy queuePrefix="DLQ." useQueueForQueueMessages="true" />
</deadLetterStrategy>
</policyEntry>