HornetQ(Live& Backup Server设置)

时间:2013-03-27 10:37:11

标签: hornetq

先谢谢,请帮我解决错误:

HornetQ Ver 2.2.14 Final

Live Server开始没有任何问题。 我可以从(Live Sever到Backup Server)和(Backup Server到Live Server)转换 通过正确的方式向下/向上运行实时服务器,即使出现以下错误

Backup Server正在开始正常启动,5秒后...... * [Thread-0(HornetQ-server-HornetQServerImpl :: serverUUID = 80d285b6-96ba-11e2-9528-817a37231a12-19420919)] 27-Mar 15:8:6,218警告[ClusterConnectionImpl]无法宣布备份,重试 HornetQException [errorCode = 3 message =等待从集群接收初始广播的超时],位于org.hornetq.core.client.impl.ServerLocatorImpl的org.hornetq.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:716) .connect(ServerLocatorImpl.java:593) org.hornetq.core.server.cluster.impl.ClusterConnectionImpl $ 2.run(ClusterConnectionImpl.java:485)at org.hornetq.utils.OrderedExecutorFactory $ OrderedExecutor $ 1.run(OrderedExecutorFactory.java:100)     at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)     at java.util.concurrent.ThreadPoolExecutor $ Worker.run(Unknown Source)     在java.lang.Thread.run(未知来源)

**Live Server Conf Files**
---------------------
1.*hornetq-configuration.xml*
-----------------------------
<configuration xmlns="urn:hornetq"
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xsi:schemaLocation="urn:hornetq /schema/hornetq-configuration.xsd">

   <clustered>true</clustered>
   <backup>false</backup>
   <shared-store>true</shared-store>
   <allow-failback>false</allow-failback>
   <failover-on-shutdown>true</failover-on-shutdown>

   <bindings-directory>d:/temp/data/bindings</bindings-directory>
   <large-messages-directory>d:/temp/data/largemessages</large-messages-directory>
   <paging-directory>d:/temp/data/paging</paging-directory>
   <journal-directory>d:/temp/data/journal</journal-directory>
   <journal-min-files>10</journal-min-files>

   <connectors>      
      <connector name="netty">
         <factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
         <param key="host"  value="192.100.101.42"/>
         <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="192.100.101.42"/>
         <param key="port"  value="5445"/>
      </acceptor>
   </acceptors>

   <broadcast-groups>
      <broadcast-group name="vsbg-group1">
         <group-address>231.7.7.7</group-address>
         <group-port>9876</group-port>
         <broadcast-period>1000</broadcast-period>
         <connector-ref>netty</connector-ref>
      </broadcast-group>
   </broadcast-groups>

   <discovery-groups>
      <discovery-group name="vsdg-group1">
         <group-address>231.7.7.7</group-address>
         <group-port>9876</group-port>
         <refresh-timeout>10000</refresh-timeout>
      </discovery-group>
   </discovery-groups>

   <cluster-connections>
      <cluster-connection name="vs-cluster">
      <address>jms</address>     
      <connector-ref>netty</connector-ref>
      <discovery-group-ref discovery-group-name="vsdg-group1"/>
      </cluster-connection>
   </cluster-connections>

   <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>       
         <address-full-policy>BLOCK</address-full-policy>
      </address-setting>
   </address-settings>



</configuration>

2.*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="ConnectionFactory">
      <xa>false</xa>
      <connectors>
         <connector-ref connector-name="netty"/>
      </connectors>
      <entries>
         <entry name="ConnectionFactory"/>
      </entries>
      <ha>true</ha>
      <retry-interval>100</retry-interval>
      <retry-interval-multiplier>1.0</retry-interval-multiplier>

   </connection-factory>



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

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

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

</configuration>

3.*Hornetq.log*
--------------
* [main] 27-Mar 15:7:52,453 INFO [HornetQBootstrapServer]  Starting HornetQ Server

* [main] 27-Mar 15:7:53,265 WARNING [FileConfigurationParser]  AIO wasn't located on this platform, it will fall back to using pure Java NIO. If your platform is Linux, install LibAIO to enable the AIO journal

* [main] 27-Mar 15:7:53,312 INFO [HornetQServerImpl]  live server is starting with configuration HornetQ Configuration (clustered=true,backup=false,sharedStore=true,journalDirectory=d:/temp/data/journal,bindingsDirectory=d:/temp/data/bindings,largeMessagesDirectory=d:/temp/data/largemessages,pagingDirectory=d:/temp/data/paging)

* [main] 27-Mar 15:7:53,312 INFO [HornetQServerImpl]  Waiting to obtain live lock

* [main] 27-Mar 15:7:53,343 INFO [JournalStorageManager]  Using NIO Journal

* [main] 27-Mar 15:7:53,359 WARNING [HornetQServerImpl]  Security risk! It has been detected that the cluster admin user and password have not been changed from the installation default. Please see the HornetQ user guide, cluster chapter, for instructions on how to do this.

* [main] 27-Mar 15:7:53,484 INFO [FileLockNodeManager]  Waiting to obtain live lock

* [main] 27-Mar 15:7:53,484 INFO [FileLockNodeManager]  Live Server Obtained live lock

* [main] 27-Mar 15:7:55,0 INFO [HornetQServerImpl]  trying to deploy queue jms.queue.LOAD_TEST

* [main] 27-Mar 15:7:55,0 INFO [HornetQServerImpl]  trying to deploy queue jms.queue.DLQ

* [main] 27-Mar 15:7:55,15 INFO [HornetQServerImpl]  trying to deploy queue jms.queue.ExpiryQueue

* [main] 27-Mar 15:7:55,109 INFO [NettyAcceptor]  Started Netty Acceptor version 3.2.5.Final-a96d88c 192.100.101.42:5445 for CORE protocol

* [main] 27-Mar 15:7:55,109 INFO [HornetQServerImpl]  Server is now live

* [main] 27-Mar 15:7:55,109 INFO [HornetQServerImpl]  HornetQ Server version 2.2.14.Final (HQ_2_2_14_FINAL, 122) [80d285b6-96ba-11e2-9528-817a37231a12]) started


**Backup Server Config Files**
-------------------------

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

   <clustered>true</clustered>
   <backup>true</backup>
   <shared-store>true</shared-store>
   <allow-failback>true</allow-failback>
   <failover-on-shutdown>false</failover-on-shutdown>



   <bindings-directory>d:/temp/data/bindings</bindings-directory>
   <large-messages-directory>d:/temp/data/largemessages</large-messages-directory>
   <paging-directory>d:/temp/data/paging</paging-directory>
   <journal-directory>d:/temp/data/journal</journal-directory>
   <journal-min-files>10</journal-min-files>

   <connectors>      
      <connector name="netty">
         <factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
         <param key="host"  value="192.100.101.42"/>
         <param key="port"  value="5446"/>
      </connector>
   </connectors>

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

   <broadcast-groups>
      <broadcast-group name="vsbg-group1">
         <group-address>231.7.7.7</group-address>
         <group-port>9876</group-port>
         <broadcast-period>1000</broadcast-period>
         <connector-ref>netty</connector-ref>
      </broadcast-group>
   </broadcast-groups>

   <discovery-groups>
      <discovery-group name="vsdg-group1">
         <group-address>231.7.7.7</group-address>
         <group-port>9876</group-port>
         <refresh-timeout>10000</refresh-timeout>
      </discovery-group>
   </discovery-groups>

   <cluster-connections>
      <cluster-connection name="vs-cluster">
      <address>jms</address>     
      <connector-ref>netty</connector-ref>
      <discovery-group-ref discovery-group-name="vsdg-group1"/>
      </cluster-connection>
   </cluster-connections>

   <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>       
         <address-full-policy>BLOCK</address-full-policy>
      </address-setting>
   </address-settings>



</configuration>

2. *hornetq-jms.xml (same as live server)*
---------------------------------------

3. *hornetq.log*
---------------
* [main] 27-Mar 15:7:55,203 INFO [HornetQBootstrapServer]  Starting HornetQ Server

* [main] 27-Mar 15:7:56,15 WARNING [FileConfigurationParser]  AIO wasn't located on this platform, it will fall back to using pure Java NIO. If your platform is Linux, install LibAIO to enable the AIO journal

* [main] 27-Mar 15:7:56,62 INFO [HornetQServerImpl]  backup server is starting with configuration HornetQ Configuration (clustered=true,backup=true,sharedStore=true,journalDirectory=d:/temp/data/journal,bindingsDirectory=d:/temp/data/bindings,largeMessagesDirectory=d:/temp/data/largemessages,pagingDirectory=d:/temp/data/paging)

* [Activation for server HornetQServerImpl::serverUUID=80d285b6-96ba-11e2-9528-817a37231a12] 27-Mar 15:7:56,62 INFO [FileLockNodeManager]  Waiting to become backup node

* [Activation for server HornetQServerImpl::serverUUID=80d285b6-96ba-11e2-9528-817a37231a12] 27-Mar 15:7:56,62 INFO [FileLockNodeManager]  ** got backup lock

* [Activation for server HornetQServerImpl::serverUUID=80d285b6-96ba-11e2-9528-817a37231a12] 27-Mar 15:7:56,93 INFO [JournalStorageManager]  Using NIO Journal

* [Activation for server HornetQServerImpl::serverUUID=80d285b6-96ba-11e2-9528-817a37231a12] 27-Mar 15:7:56,109 WARNING [HornetQServerImpl]  Security risk! It has been detected that the cluster admin user and password have not been changed from the installation default. Please see the HornetQ user guide, cluster chapter, for instructions on how to do this.

* [Activation for server HornetQServerImpl::serverUUID=80d285b6-96ba-11e2-9528-817a37231a12] 27-Mar 15:7:56,218 INFO [HornetQServerImpl]  HornetQ Backup Server version 2.2.14.Final (HQ_2_2_14_FINAL, 122) [80d285b6-96ba-11e2-9528-817a37231a12] started, waiting live to fail before it gets active

* [Thread-0 (HornetQ-server-HornetQServerImpl::serverUUID=80d285b6-96ba-11e2-9528-817a37231a12-19420919)] 27-Mar 15:8:6,218 WARNING [ClusterConnectionImpl]  Unable to announce backup, retrying
HornetQException[errorCode=3 message=Timed out waiting to receive initial broadcast from cluster]
    at org.hornetq.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:716)
    at org.hornetq.core.client.impl.ServerLocatorImpl.connect(ServerLocatorImpl.java:593)
    at org.hornetq.core.server.cluster.impl.ClusterConnectionImpl$2.run(ClusterConnectionImpl.java:485)
    at org.hornetq.utils.OrderedExecutorFactory$OrderedExecutor$1.run(OrderedExecutorFactory.java:100)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

* [Thread-1 (HornetQ-server-HornetQServerImpl::serverUUID=80d285b6-96ba-11e2-9528-817a37231a12-19420919)] 27-Mar 15:8:16,734 WARNING [ClusterConnectionImpl]  Unable to announce backup, retrying
HornetQException[errorCode=3 message=Timed out waiting to receive initial broadcast from cluster]
    at org.hornetq.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:716)
    at org.hornetq.core.client.impl.ServerLocatorImpl.connect(ServerLocatorImpl.java:593)
    at org.hornetq.core.server.cluster.impl.ClusterConnectionImpl$2.run(ClusterConnectionImpl.java:485)
    at org.hornetq.utils.OrderedExecutorFactory$OrderedExecutor$1.run(OrderedExecutorFactory.java:100)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

* [Thread-2 (HornetQ-server-HornetQServerImpl::serverUUID=80d285b6-96ba-11e2-9528-817a37231a12-19420919)] 27-Mar 15:8:27,250 WARNING [ClusterConnectionImpl]  Unable to announce backup, retrying
HornetQException[errorCode=3 message=Timed out waiting to receive initial broadcast from cluster]
    at org.hornetq.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:716)
    at org.hornetq.core.client.impl.ServerLocatorImpl.connect(ServerLocatorImpl.java:593)
    at org.hornetq.core.server.cluster.impl.ClusterConnectionImpl$2.run(ClusterConnectionImpl.java:485)
    at org.hornetq.utils.OrderedExecutorFactory$OrderedExecutor$1.run(OrderedExecutorFactory.java:100)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

* [Activation for server HornetQServerImpl::serverUUID=80d285b6-96ba-11e2-9528-817a37231a12] 27-Mar 15:8:29,187 INFO [HornetQServerImpl]  trying to deploy queue jms.queue.LOAD_TEST

* [Activation for server HornetQServerImpl::serverUUID=80d285b6-96ba-11e2-9528-817a37231a12] 27-Mar 15:8:29,187 INFO [HornetQServerImpl]  trying to deploy queue jms.queue.DLQ

* [Activation for server HornetQServerImpl::serverUUID=80d285b6-96ba-11e2-9528-817a37231a12] 27-Mar 15:8:29,203 INFO [HornetQServerImpl]  trying to deploy queue jms.queue.ExpiryQueue

* [Activation for server HornetQServerImpl::serverUUID=80d285b6-96ba-11e2-9528-817a37231a12] 27-Mar 15:8:29,265 INFO [NettyAcceptor]  Started Netty Acceptor version 3.2.5.Final-a96d88c 192.100.101.42:5446 for CORE protocol

* [Thread-3 (HornetQ-server-HornetQServerImpl::serverUUID=80d285b6-96ba-11e2-9528-817a37231a12-19420919)] 27-Mar 15:8:29,281 WARNING [ClusterConnectionImpl]  Unable to announce backup, retrying
HornetQException[errorCode=3 message=Timed out waiting to receive initial broadcast from cluster]
    at org.hornetq.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:716)
    at org.hornetq.core.client.impl.ServerLocatorImpl.connect(ServerLocatorImpl.java:593)
    at org.hornetq.core.server.cluster.impl.ClusterConnectionImpl$2.run(ClusterConnectionImpl.java:485)
    at org.hornetq.utils.OrderedExecutorFactory$OrderedExecutor$1.run(OrderedExecutorFactory.java:100)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

* [Activation for server HornetQServerImpl::serverUUID=80d285b6-96ba-11e2-9528-817a37231a12] 27-Mar 15:8:29,296 INFO [HornetQServerImpl]  Backup Server is now live

* [Thread-8 (HornetQ-server-HornetQServerImpl::serverUUID=80d285b6-96ba-11e2-9528-817a37231a12-19420919)] 27-Mar 15:8:29,812 WARNING [ClusterConnectionImpl]  Unable to announce backup, retrying
java.lang.NullPointerException
    at org.hornetq.core.server.cluster.impl.ClusterConnectionImpl$2.run(ClusterConnectionImpl.java:485)
    at org.hornetq.utils.OrderedExecutorFactory$OrderedExecutor$1.run(OrderedExecutorFactory.java:100)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

* [Thread-9 (HornetQ-server-HornetQServerImpl::serverUUID=80d285b6-96ba-11e2-9528-817a37231a12-19420919)] 27-Mar 15:8:30,328 WARNING [ClusterConnectionImpl]  Unable to announce backup, retrying
java.lang.NullPointerException
    at org.hornetq.core.server.cluster.impl.ClusterConnectionImpl$2.run(ClusterConnectionImpl.java:485)
    at org.hornetq.utils.OrderedExecutorFactory$OrderedExecutor$1.run(OrderedExecutorFactory.java:100)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

* [Thread-10 (HornetQ-server-HornetQServerImpl::serverUUID=80d285b6-96ba-11e2-9528-817a37231a12-19420919)] 27-Mar 15:8:30,843 WARNING [ClusterConnectionImpl]  Unable to announce backup, retrying
java.lang.NullPointerException
    at org.hornetq.core.server.cluster.impl.ClusterConnectionImpl$2.run(ClusterConnectionImpl.java:485)
    at org.hornetq.utils.OrderedExecutorFactory$OrderedExecutor$1.run(OrderedExecutorFactory.java:100)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

* [Thread-11 (HornetQ-server-HornetQServerImpl::serverUUID=80d285b6-96ba-11e2-9528-817a37231a12-19420919)] 27-Mar 15:8:31,359 WARNING [ClusterConnectionImpl]  Unable to announce backup, retrying
java.lang.NullPointerException
    at org.hornetq.core.server.cluster.impl.ClusterConnectionImpl$2.run(ClusterConnectionImpl.java:485)
    at org.hornetq.utils.OrderedExecutorFactory$OrderedExecutor$1.run(OrderedExecutorFactory.java:100)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

* [Thread-12 (HornetQ-server-HornetQServerImpl::serverUUID=80d285b6-96ba-11e2-9528-817a37231a12-19420919)] 27-Mar 15:8:32,31 WARNING [ClusterConnectionImpl]  Unable to announce backup, retrying
java.lang.NullPointerException
    at org.hornetq.core.server.cluster.impl.ClusterConnectionImpl$2.run(ClusterConnectionImpl.java:485)
    at org.hornetq.utils.OrderedExecutorFactory$OrderedExecutor$1.run(OrderedExecutorFactory.java:100)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

* [hornetq-shutdown-thread] 27-Mar 15:8:32,109 INFO [HornetQBootstrapServer]  Stopping HornetQ Server...

2 个答案:

答案 0 :(得分:0)

我认为如果它们在同一台计算机上,您应该将主机的连接器和接受器更改为“localhost”。 (但我认为你的配置还可以,这是一个网络(UDP)问题)

答案 1 :(得分:0)

在你的hornetq-jms.xml中,你应该将以下属性添加到ConnectionFactory元素。

 <discovery-group-ref discovery-group-name="my-discovery-group"/>