我使用的是 apache-activemq-5.11.1,这是在 JDK 7(主要版本 51.0)上运行的稳定版本,我使用的是 JDK 7 Update 80。如果我在 JDK 6 上运行相同的版本,则会出现错误。
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/ac tivemq/console/Main : Unsupported major.minor version 51.0
谈到我的问题,我的系统中需要有两个正在运行的 ActiveMQ 实例。我按照以下步骤创建了两个实例。
C:\>cd \apache-activemq-5.11.1
C:\apache-activemq-5.11.1>.\bin\activemq create instance1
C:\apache-activemq-5.11.1>.\bin\activemq create instance2
我已将实例2更改为不同的端口号集,如下所示,
<!--EDITED: apache-activemq-5.11.1\instance2\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:61716?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
<transportConnector name="amqp" uri="amqp://0.0.0.0:5772?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
<transportConnector name="stomp" uri="stomp://0.0.0.0:61713?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
<transportConnector name="mqtt" uri="mqtt://0.0.0.0:1983?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
<transportConnector name="ws" uri="ws://0.0.0.0:61714?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
</transportConnectors>
现在我正在启动实例1和实例2,如下......
C:\apache-activemq-5.11.1\instance1\bin>instance1 start
C:\apache-activemq-5.11.1\instance1\bin>instance2 start
其中我尝试启动的第二个实例出现以下 kahadb 锁定问题......
INFO | Refreshing org.apache.activemq.xbean.XBeanBrokerFactory$1@7209d9af: startup date [Thu May 07 16:16:23 IST 2015]; root of context hierarchy
INFO | PListStore:[C:\apache-activemq-5.11.1\data\localhost\tmp_storage] started
INFO | Using Persistence Adapter: KahaDBPersistenceAdapter[C:\apache-activemq-5.11.1\data\kahadb]
INFO | Database C:\apache-activemq-5.11.1\data\kahadb\lock is locked... waiting 10 seconds for the database to be unlocked. Reason: java.io.IOException: File 'C:\apache-activemq-5.11.1\data\kahadb\lock' could not be locked.
请给出此数据库锁定问题的解决方案。
最佳答案
制作 ActiveMQ 的副本,例如将 apache-activemq-x.xx.x
复制到 apache-activemq-x.xx.x_2
更改 apache-activemq-x.xx.x_2\conf\activemq.xml
的端口。确保您要更改的端口号不冲突。
<!--EDIT: apache-activemq-5.11.1_2\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:61716?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
<transportConnector name="amqp" uri="amqp://0.0.0.0:5772?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
<transportConnector name="stomp" uri="stomp://0.0.0.0:61713?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
<transportConnector name="mqtt" uri="mqtt://0.0.0.0:1983?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
<transportConnector name="ws" uri="ws://0.0.0.0:61714?maximumConnections=1000&wireFormat.maxFrameSize=104857600"/>
</transportConnectors>
除了端口更改之外,我们还必须更正 jetty.xml http 管理控制台端口。
<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="8162"/>
</bean>
这样就可以在一个系统中运行ActiveMQ的两个服务了。
关于apache - 如何在一个系统中运行两个 Apache ActiveMQ 实例?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30099070/