7 Replies Latest reply on Jan 2, 2013 10:59 AM by jbertram

    Two clusters on same network

    ejb3workshop

      I would like to run two (or more) hornetq clusters on the same network. Initially I was hoping that simply having different data directories would be sufficient, however this does not seem to be the case as messages were distributed across all servers. I then changed the cluster-connection name on one of the clusters from mycluster to my-other-cluster

      <cluster-connection name="my-other-cluster">

      However messages were still being distributed between the clusters.  Only once I changed the discovery-group name did message remain on their respective cluster.

      <discovery-groups>

          <discovery-group name="my-other-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="my-other-cluster">

            <address>jms</address>

            <connector-ref>netty</connector-ref>

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

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

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

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

          </cluster-connection>

        </cluster-connections>

      This suggests that the discovery-group name is sufficient to distinguish between clusters. I want to confirm that this is the case and that this is the minimum amount of change to the configuration to ensure each cluster can run independenly of each other, while still being able to discover and access nodes within the same cluster.

        • 1. Re: Two clusters on same network
          ataylor

          No, the name is just used for other services to look up the discovery group. You will need to change either the address or port for both the broadcast and the discovery groups

          1 of 1 people found this helpful
          • 2. Re: Two clusters on same network
            ejb3workshop

            That is what I was affraid of. However it seems to be working at the moment with only a different name, which is rather strange. Is there an explanation for this ?

            • 3. Re: Two clusters on same network
              ataylor

              That is what I was affraid of. However it seems to be working at the moment with only a different name, which is rather strange. Is there an explanation for this ?

              Nope, apart from coincedence. Just change the address and port like i suggested to gain the desired effects you want

              • 4. Re: Two clusters on same network
                ejb3workshop

                And I only have to change this on the discovery group ?

                • 5. Re: Two clusters on same network
                  ataylor

                  yes, just use a unique address for each cluster

                  • 6. Re: Two clusters on same network
                    zivley

                    Hi there,

                    My need is exactly what Alexander didn't want, I want to have two clusters where messages are actually distributing across both of them, and I wanted to make sure if the solution is so simple as just setting the same IP or port on both discovery groups and that's it? Is that a correct way to do it or there is a better way?

                    I wouldn't want to base my solution on something that works "by mistake"

                    Thanks in advance

                    • 7. Re: Two clusters on same network
                      jbertram

                      Nodes which use discovery groups find each other based on the use of a shared group address and port.  Therefore, if two nodes share the same discovery address and port then they should find each other granted the network allows UDP multi-cast traffic between them.