6 Replies Latest reply on Apr 27, 2011 8:48 AM by Andy Taylor

    Cluster with explicitly specified nodes

    Andrey Kreysman Newbie

      Hello

       

      Please advice on the cluster configuration with explicitly specified nodes.

      I'm doing all according documentation. There are two node with runned hornetQ servers 192.168.0.214 and 192.168.0.219. The JMS message appears on first node but it is not sent to the second one.

       

      I have next in my hornetq-configuration.xml

       

      {code:xml}

      ...

      <connectors>

                          <connector name="in-vm">

                                    <factory-class>org.hornetq.core.remoting.impl.invm.InVMConnectorFactory</factory-class>

                          </connector>

                          <connector name="cluster-1">

                                    <factory-class>org.hornetq.integration.transports.netty.NettyConnectorFactory</factory-class>

                                    <param key="host" value="192.168.0.214" />

                                    <param key="port" value="5446" />

                          </connector>

                          <connector name="cluster-2">

                                    <factory-class>org.hornetq.integration.transports.netty.NettyConnectorFactory</factory-class>

                                    <param key="host" value="192.168.0.219" />

                                    <param key="port" value="5446" />

                          </connector>

                </connectors>

        <acceptors>

                          <acceptor name="in-vm">

                                    <factory-class>org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory</factory-class>

                          </acceptor>

         <acceptor name="netty">

                                    <factory-class>org.hornetq.integration.transports.netty.NettyAcceptorFactory</factory-class>

                                    <param key="host" value="0.0.0.0" />

                                    <param key="port" value="5446" />

                          </acceptor>

                </acceptors>

       

      <cluster-connections>

       

       

                          <cluster-connection name="cluster-1">

                                    <address>#</address>

                                    <retry-interval>500</retry-interval>

                                    <use-duplicate-detection>true</use-duplicate-detection>

                                    <forward-when-no-consumers>true</forward-when-no-consumers>

                                    <max-hops>1</max-hops>

                                    <connector-ref connector-name="cluster-1" />

                          </cluster-connection>

                           <cluster-connection name="cluster-2">

                                    <address>#</address>

                                    <retry-interval>500</retry-interval>

                                    <use-duplicate-detection>true</use-duplicate-detection>

                                    <forward-when-no-consumers>true</forward-when-no-consumers>

                                    <max-hops>1</max-hops>

                                    <connector-ref connector-name="cluster-2" />

                          </cluster-connection>

                </cluster-connections>

      ...

      {code}

      and in hornetq-jms.xml

       

      {code:xml}

        <connection-factory name="InVMConnectionFactory">

          <connectors>

            <connector-ref connector-name="in-vm" />

          </connectors>

          <entries>

            <entry name="/HQConnectionFactory" />

          </entries>

        </connection-factory>

      {code}

       

      Where is my mistake? Is the mentioned config enough? It starts be working if I add all connectors into connection-factory settings but as I understood it should work without it.

       

      There is complete source code in attach

        • 1. Cluster with explicitly specified nodes
          Andy Taylor Master

          what version are you using, this has changed in the latest version?

          • 2. Cluster with explicitly specified nodes
            Andy Taylor Master

            also, why do you expect the message to be on both nodes? or are you talking about multiple messages and also are you looking for client side load balancing or server side? please give as much info as possible

            • 3. Cluster with explicitly specified nodes
              Andrey Kreysman Newbie

              Thanks for reply.

               

              1. versioin - 2.0.0.GA, It seems this versioin supports such clustering.

               

              2.1 I have jms queue and as I understood it is shared between nodes in cluster. So in my case if I send the message in one node (There is client and HornetQ server on same PC) it can be listened in another node (second PC). Am I right?

              2.2 I think I am looking for server side load balancing (The server is responsible for the messages distribution, Is it correct?)

              2.3 Actually I need something similar to the example "11.1.24. Load Balanced Clustered Queue" but without broadcasting.

              • 4. Cluster with explicitly specified nodes
                Andy Taylor Master

                Ok, firstly let me explain how it woill work.

                 

                If you have 2 nodes forming a cluster both with queue A on each node the following will happen. If a message is delivered to node A and both nodes have consumers on there respective queues messages will be round robined between the nodes. if the remote node has no consumers then they will always be delivered locally.

                 

                Now looking at your config it seems you have 2 cluster connections defined and i am not sure why, each node should have 1 cluster connection defined to the other node. I would start by correcting this, start by looking at the example you mentioned, this is a good point to start at.

                • 5. Cluster with explicitly specified nodes
                  Andrey Kreysman Newbie

                  Thanks a lot.

                   

                  1. I have a publisher on node A and a consumer on node B. Also I have

                   

                  <forward-when-no-consumers>true</forward-when-no-consumers>

                   

                  so I think the messages should be delivered in any case.

                   

                  2. I have to connections for unifying config of nodes, so in each config there is:

                  config A:

                  <connection-to-A>

                  <connection-to-B>

                   

                  config B:

                  <connection-to-A>

                  <connection-to-B>

                   

                  It doesn't fix the problem if I comment local connection.

                   

                   

                  Thanks for your advices. I'll try to increase version and check the spring integration, maybe something is wrong there.

                  • 6. Cluster with explicitly specified nodes
                    Andy Taylor Master

                    youcant unify config of nodes, especially around clusters, this will cause problems. make sure each config has one cluster connection and it should work fine.