0

我正在尝试在两个不同的主机上运行新的 HornetQ 2.3.0.alpha复制。当我在我的本地机器上尝试它时,它或多或少地工作(用不同的端口分隔 hornetq)。我将在稍后更详细地解释它。

我在最新的 64 位 Xubuntu(本地测试)和 CentO(分布式)、Oracle JDK 6u33(但也尝试了其他版本)上使用普通的香草HornetQ 2.3.0.alpha 。

现在在本地测试时,我使用不同的端口进行备份(5446)。我开始直播,然后是备份服务器。备份与实时同步。我杀死/停止直播。相反,备份将继续工作,并请求备份工作(现在在 5445 上运行)。现在我想重新开始直播,但它不起作用,因为备份使用的是 5445。因此我的下一个测试是在不同的机器上启动直播/备份。

在分离的主机上,实时服务器按预期启动。当我开始备份时,当他复制一些数据目录时它会挂起。在那之后,他得到了暂停。它们之间没有防火墙或其他任何东西,我已经检查了两次并与我的本地管理员一起检查。从备份主机到实时主机的 Telnet 工作正常。

这是我在备份中遇到的例外情况,我在下面附加了我的配置:

***********************************************************************************
java  -XX:+UseParallelGC -XX:+AggressiveOpts -XX:+UseFastAccessorMethods -Xms512M -Xmx1024M -Dhornetq.config.dir=../config/stand-alone/non-clustered -Djava.util.logging.manager=org.jboss.logmanager.LogManager -Dlogging.configuration=../config/stand-alone/non-clustered/logging.properties -Djava.library.path=. -classpath ../lib/netty.jar:../lib/jnpserver.jar:../lib/jnp-client.jar:../lib/jboss-mc.jar:../lib/jboss-jms-api.jar:../lib/hornetq-twitter-integration.jar:../lib/hornetq-spring-integration.jar:../lib/hornetq-service-sar.jar:../lib/hornetq-rest.jar:../lib/hornetq-journal.jar:../lib/hornetq-jms.jar:../lib/hornetq-jms-client.jar:../lib/hornetq-jboss-as-integration.jar:../lib/hornetq-core.jar:../lib/hornetq-core-client.jar:../lib/hornetq-commons.jar:../lib/hornetq-bootstrap.jar:../config/stand-alone/non-clustered:../schemas/ org.hornetq.integration.bootstrap.HornetQBootstrapServer hornetq-beans.xml
***********************************************************************************
Unable to read the logging configuration from '../config/stand-alone/non-clustered/logging.properties' (java.net.MalformedURLException: no protocol: ../config/stand-alone/non-clustered/logging.properties)
11:50:37,611 INFO  [org.hornetq.integration.bootstrap] HQ101001: Starting HornetQ Server
11:50:38,932 INFO  [org.hornetq.core.server] HQ111001: backup server is starting with configuration HornetQ Configuration (clustered=true,backup=true,sharedStore=false,journalDirectory=../data/journal,bindingsDirectory=../data/bindings,largeMessagesDirectory=../data/large-messages,pagingDirectory=../data/paging)
11:50:38,950 WARN  [org.hornetq.core.server] HQ112216: Moving data directory ../data/bindings to ../data/bindings22
11:50:38,952 WARN  [org.hornetq.core.server] HQ112216: Moving data directory ../data/journal to ../data/journal22
11:50:38,953 WARN  [org.hornetq.core.server] HQ112216: Moving data directory ../data/paging to ../data/paging22
11:50:38,953 WARN  [org.hornetq.core.server] HQ112216: Moving data directory ../data/large-messages to ../data/large-messages22
11:51:39,106 ERROR [org.hornetq.core.server] HQ114002: Failure in initialisation: java.lang.RuntimeException: Could not estabilish the connection
    at org.hornetq.core.server.impl.HornetQServerImpl$SharedNothingBackupActivation.run(HornetQServerImpl.java:2152) [hornetq-core.jar:]
    at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_33]

java.lang.RuntimeException: Could not estabilish the connection
    at org.hornetq.core.server.impl.HornetQServerImpl$SharedNothingBackupActivation.run(HornetQServerImpl.java:2152)
    at java.lang.Thread.run(Thread.java:662)

配置文件

我使用默认配置文件作为基础(config/stand-alone/non-clustered)

实时配置文件

hornetq-configuration.xml

<configuration xmlns="urn:hornetq"
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xsi:schemaLocation="urn:hornetq /schema/hornetq-configuration.xsd">

   <paging-directory>${data.dir:../data}/paging</paging-directory>
   <bindings-directory>${data.dir:../data}/bindings</bindings-directory>
   <journal-directory>${data.dir:../data}/journal</journal-directory>
   <journal-min-files>10</journal-min-files>
   <large-messages-directory>${data.dir:../data}/large-messages</large-messages-directory>

   <connectors>
      <connector name="netty">
         <factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
         <param key="host"  value="${hornetq.remoting.netty.host:localhost}"/>
         <param key="port"  value="${hornetq.remoting.netty.port:5445}"/>
      </connector>
      <connector name="remote-connector">
         <factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
         <param key="host"  value="192.168.40.155"/>
         <param key="port" value="5445"/>
      </connector>
   </connectors>

   <acceptors>
      <acceptor name="netty">
         <factory-class>org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>
         <param key="host"  value="0.0.0.0"/>
         <param key="port"  value="${hornetq.remoting.netty.port:5445}"/>
      </acceptor>
   </acceptors>

   <security-settings>
      <security-setting match="#">
         <permission type="createNonDurableQueue" roles="guest"/>
         <permission type="deleteNonDurableQueue" roles="guest"/>
         <permission type="consume" roles="guest"/>
         <permission type="send" roles="guest"/>
      </security-setting>
   </security-settings>

   <address-settings>
      <!--default for catch all-->
      <address-setting match="#">
         <dead-letter-address>jms.queue.DLQ</dead-letter-address>
         <expiry-address>jms.queue.ExpiryQueue</expiry-address>
         <redelivery-delay>0</redelivery-delay>
         <max-size-bytes>10485760</max-size-bytes>
         <message-counter-history-day-limit>10</message-counter-history-day-limit>
         <address-full-policy>BLOCK</address-full-policy>
      </address-setting>
   </address-settings>

   <shared-store>false</shared-store>
   <clustered>true</clustered>
   <failover-on-shutdown>false</failover-on-shutdown>
   <cluster-user>cluster-user</cluster-user>
   <cluster-password>cluster123</cluster-password>

   <cluster-connections>
      <cluster-connection name="test-cluster">
         <address>jms</address>
         <connector-ref>netty</connector-ref>
         <retry-interval>2000</retry-interval>
         <use-duplicate-detection>true</use-duplicate-detection>
         <forward-when-no-consumers>true</forward-when-no-consumers>
         <max-hops>1</max-hops>
         <static-connectors allow-direct-connections-only="true">
            <connector-ref>remote-connector</connector-ref>
         </static-connectors>
      </cluster-connection>
   </cluster-connections>

   <backup>false</backup>

</configuration>

hornetq-jms.xml

<configuration xmlns="urn:hornetq"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="urn:hornetq /schema/hornetq-jms.xsd">

   <connection-factory name="NettyConnectionFactory">
      <xa>false</xa>
      <ha>true</ha>
      <reconnect-attempts>-1</reconnect-attempts>
      <retry-interval>1000</retry-interval>

      <connectors>
         <connector-ref connector-name="netty"/>
      </connectors>
      <entries>
         <entry name="/ConnectionFactory"/>
      </entries>
   </connection-factory>

   <queue name="DLQ">
      <entry name="/queue/DLQ"/>
   </queue>

   <queue name="ExpiryQueue">
      <entry name="/queue/ExpiryQueue"/>
   </queue>

   <queue name="testing">
      <entry name="/queue/testing" />
      <durable>true</durable>
   </queue>

</configuration>

备份配置文件

hornetq-configuration.xml

<configuration xmlns="urn:hornetq"
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xsi:schemaLocation="urn:hornetq /schema/hornetq-configuration.xsd">

   <paging-directory>${data.dir:../data}/paging</paging-directory>
   <bindings-directory>${data.dir:../data}/bindings</bindings-directory>
   <journal-directory>${data.dir:../data}/journal</journal-directory>
   <journal-min-files>10</journal-min-files>
   <large-messages-directory>${data.dir:../data}/large-messages</large-messages-directory>

   <connectors>
      <connector name="netty">
         <factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
         <param key="host"  value="${hornetq.remoting.netty.host:localhost}"/>
         <param key="port"  value="${hornetq.remoting.netty.port:5445}"/>
      </connector>
      <connector name="remote-connector">
         <factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
         <param key="host"  value="192.168.40.180"/>
         <param key="port" value="5445"/>
      </connector>
   </connectors>

   <acceptors>
      <acceptor name="netty">
         <factory-class>org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>
         <param key="host"  value="0.0.0.0"/>
         <param key="port"  value="5445"/>
      </acceptor>
   </acceptors>

   <security-settings>
      <security-setting match="#">
         <permission type="createNonDurableQueue" roles="guest"/>
         <permission type="deleteNonDurableQueue" roles="guest"/>
         <permission type="consume" roles="guest"/>
         <permission type="send" roles="guest"/>
      </security-setting>
   </security-settings>

   <address-settings>
      <!--default for catch all-->
      <address-setting match="#">
         <dead-letter-address>jms.queue.DLQ</dead-letter-address>
         <expiry-address>jms.queue.ExpiryQueue</expiry-address>
         <redelivery-delay>0</redelivery-delay>
         <max-size-bytes>10485760</max-size-bytes>
         <message-counter-history-day-limit>10</message-counter-history-day-limit>
         <address-full-policy>BLOCK</address-full-policy>
      </address-setting>
   </address-settings>

   <shared-store>false</shared-store>
   <clustered>true</clustered>
   <failover-on-shutdown>false</failover-on-shutdown>
   <cluster-user>cluster-user</cluster-user>
   <cluster-password>cluster123</cluster-password>
   <live-connector-ref connector-name="remote-connector"/>


   <cluster-connections>
      <cluster-connection name="test-cluster">
         <address>jms</address>
         <connector-ref>netty</connector-ref>
         <retry-interval>2000</retry-interval>
         <use-duplicate-detection>true</use-duplicate-detection>
         <forward-when-no-consumers>true</forward-when-no-consumers>
         <max-hops>1</max-hops>
         <static-connectors allow-direct-connections-only="true">
            <connector-ref>remote-connector</connector-ref>
         </static-connectors>
      </cluster-connection>
   </cluster-connections>

   <backup>true</backup>

</configuration>

hornetq-jms.xml

<configuration xmlns="urn:hornetq"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="urn:hornetq /schema/hornetq-jms.xsd">

   <connection-factory name="NettyConnectionFactory">
      <xa>false</xa>
      <ha>true</ha>
      <reconnect-attempts>-1</reconnect-attempts>
      <retry-interval>1000</retry-interval>

      <connectors>
         <connector-ref connector-name="netty"/>
      </connectors>
      <entries>
         <entry name="/ConnectionFactory"/>
      </entries>
   </connection-factory>

   <queue name="DLQ">
      <entry name="/queue/DLQ"/>
   </queue>

   <queue name="ExpiryQueue">
      <entry name="/queue/ExpiryQueue"/>
   </queue>

   <queue name="testing">
      <entry name="/queue/testing" />
      <durable>true</durable>
   </queue>

</configuration>

当我在本地创建沙箱时,它使用相同的配置,除了为了备份,hornetq-beans.xml 被更改为将端口从 1099/1098 移动到 1199/1198。

我已经为此工作了几天,并且已经尝试了各种组合,所以如果我错过了什么,请原谅。非常感谢!

4

1 回答 1

1

HornetQ 2.3 正在积极开发中。我建议您在用户论坛而不是所有开发人员工作的 SOF 上提出这个问题。

无论如何,我们即将发布一个测试版,我们改变了节点之间的连接方式。我们甚至删除了一个参数并改变了一些东西。所以我肯定会推荐你在 HOrnetQ 用户论坛上与我们交谈。也许在 github 上的 hornetq/master 上试一试。

于 2012-09-17T01:46:26.950 回答