2 Replies Latest reply on Jul 16, 2013 3:55 AM by nathanhastings

    Cluster with Live/Backup HornetQ instance in each node, no multicast

    nathanhastings Newbie

      I have been unable to find a reference configuration for a cluster with Live/Backup HornetQ instance in each node but not using multicast.

      There is information on clustering and separately there is information on using TCP with JGroups but in my testing combining these two things has challenges.

      I have found a configuration that appears to work but am unsure if it is optimal and would appreciate comments.

       

      Firstly I have set the jgroups default-stack to tcp and replaced MPING with TCPPING configuring the initial_hosts property.

       

      <subsystem xmlns="urn:jboss:domain:jgroups:1.1" default-stack="tcp">

                  <stack name="tcp">

                      <transport socket-binding="jgroups-tcp" type="TCP"/>

                      <protocol type="TCPPING">

                                                        <property name="initial_hosts">${jgroups.tcpping.initial_hosts}</property>

                                                        <property name="num_initial_members">2</property>

                                                        <property name="port_range">1</property>

                                                        <property name="timeout">2000</property>

                                              </protocol>

       

      Next in the HornetQ config I have modified the broadcast-group and discovery-group replacing

       

      <socket-binding>messaging-group</socket-binding>

       

      with

       

      <jgroups-stack>tcp</jgroups-stack>

      <jgroups-channel>hornetq_broadcast_channel</jgroups-channel>

       

      This has been described in various guides I have found in the internet, however it does not work in a node with a Live and Backup HornetQ instance.

       

      11:40:45,732 ERROR [org.hornetq.core.server] (MSC service thread 1-1) HQ224000: Failure in initialisation: java.lang.IllegalStateException: cluster 'hornetq_broadcast_channel' is already connected to singleton transport: [hornetq_broadcast_channel, dummy-1373593231748, web]

                at org.jgroups.stack.ProtocolStack.startStack(ProtocolStack.java:919) [jgroups-3.2.7.Final-redhat-1.jar:3.2.7.Final-redhat-1]

                at org.jgroups.JChannel.startStack(JChannel.java:827) [jgroups-3.2.7.Final-redhat-1.jar:3.2.7.Final-redhat-1]

                at org.jgroups.JChannel._preConnect(JChannel.java:525) [jgroups-3.2.7.Final-redhat-1.jar:3.2.7.Final-redhat-1]

       

      It appears a jgroups channel is limited to one HornetQ instance in each node.

      All Live instances must be on the same channel to communicate and each Backup->Live pair must be on the same channel for the Backup to announce itself.

       

      To get this work in a cluster of 2 nodes I have configured 3 channels.

       

      Example:

       

      Node 1:

      Live HornetQ

       

      <broadcast-groups>

                          <broadcast-group name="bg-group1">

                     <jgroups-stack>tcp</jgroups-stack>

                                    <jgroups-channel>live</jgroups-channel>

                                    <broadcast-period>5000</broadcast-period>

                                    <connector-ref>

                                              netty

                                    </connector-ref>

                          </broadcast-group>

                          <broadcast-group name="bg-group2">

                    <jgroups-stack>tcp</jgroups-stack>

                                    <jgroups-channel>node1_live_to_node2_backup</jgroups-channel>

                                    <broadcast-period>5000</broadcast-period>

                                    <connector-ref>

                                              netty

                                    </connector-ref>

                          </broadcast-group>

                </broadcast-groups>

       

      Backup HornetQ

       

      <broadcast-groups>

                          <broadcast-group name="bg-group1">

                    <jgroups-stack>tcp</jgroups-stack>

                                    <jgroups-channel>node2_live_to_node1_backup</jgroups-channel>

                                    <broadcast-period>5000</broadcast-period>

                                    <connector-ref>

                                              netty-connector

                                    </connector-ref>

                          </broadcast-group>

                </broadcast-groups>

       

      Node2:

       

      Live HornetQ

       

      <broadcast-groups>

                <broadcast-group name="bg-group1">

                     <jgroups-stack>tcp</jgroups-stack>

                     <jgroups-channel>live</jgroups-channel>

                     <broadcast-period>5000</broadcast-period>

                     <connector-ref>

                          netty

                     </connector-ref>

                </broadcast-group>

                <broadcast-group name="bg-group2">

                    <jgroups-stack>tcp</jgroups-stack>

                     <jgroups-channel>node1_live_to_node2_backup</jgroups-channel>

                     <broadcast-period>5000</broadcast-period>

                     <connector-ref>

                          netty

                     </connector-ref>

                </broadcast-group>

           </broadcast-groups>

       

      Backup HornetQ

       

      <broadcast-groups>

               <broadcast-group name="bg-group1">

                    <jgroups-stack>tcp</jgroups-stack>

                     <jgroups-channel>node2_live_to_node1_backup</jgroups-channel>

                     <broadcast-period>5000</broadcast-period>

                     <connector-ref>

                         netty-connector

                     </connector-ref>

               </broadcast-group>

           </broadcast-groups>

       

      Is this really the only to make this scenario work?