7 Replies Latest reply on Aug 9, 2012 3:03 PM by wporter

    HornetQ 2.3.0 Alpha replication

    amshaik

      Hi,

       

      I'm attempting to configure replication and failover in HornetQ 2.3.0 Alpha using static connectors. I'm able to start the live server, but when I attempt to start the backup server, it hangs for some time, and then I receive the following error:

       

      ERROR: HQ114002: Failure in initialisation

      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)

      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)

      Aug 8, 2012 10:08:12 AM org.hornetq.integration.bootstrap.HornetQBootstrapServer shutDown

      INFO: HQ101002: Stopping HornetQ Server

       

       

      In my live server's hornetq-configuration.xml, I have:

       

      <configuration xmlns="urn:hornetq"

                     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                     xsi:schemaLocation="urn:hornetq /schema/hornetq-configuration.xsd">

       

       

         <bindings-directory>${data.dir:../../data}/bindings</bindings-directory>

       

       

         <journal-directory>${data.dir:../../data}/journal</journal-directory>

       

         <large-messages-directory>${data.dir:../../data}/large-messages</large-messages-directory>

       

        <connectors>

            <connector name="netty-backup">

              <factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>

              <param key="host"  value="${hornetq.remoting.netty.host: myBackupHost}"/>

              <param key="port"  value="${hornetq.remoting.netty.port:5445}"/>

            </connector>

        </connectors>

        <acceptors>

            <acceptor name="netty">

               <factory-class>org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>

               <param key="host"  value="${hornetq.remoting.netty.host: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="createDurableQueue" roles="guest"/>

               <permission type="deleteDurableQueue" roles="guest"/>

               <permission type="consume" roles="guest"/>

               <permission type="send" roles="guest"/>

            </security-setting>

        </security-settings>

       

       

        <shared-store>false</shared-store>

        <clustered>true</clustered>

        <allow-failback>true</allow-failback>


        <cluster-connections>

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

                      <address>jms</address>

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

                      <static-connectors allow-direct-connections-only="true">

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

                      </static-connectors>

              </cluster-connection>

        </cluster-connections>

       

      </configuration>

       

       

      My backup server's configuration is:

       

      <configuration xmlns="urn:hornetq"

                     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

                     xsi:schemaLocation="urn:hornetq /schema/hornetq-configuration.xsd">

       

       

        <backup>true</backup>

        <shared-store>false</shared-store>

        <live-connector-ref connector-name = "netty-live"/>

        <clustered>true</clustered>

        <connectors>

            <connector name = "netty-live">

              <factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>

              <param key="host"  value="${hornetq.remoting.netty.host:myLiveHost}"/>

              <param key="port"  value="${hornetq.remoting.netty.port:5445}"/>

            </connector>

         </connectors>

       

       

         <acceptors>

            <acceptor name="netty">

               <factory-class>org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>

               <param key="host"  value="${hornetq.remoting.netty.host:0.0.0.0}"/>

               <param key="port"  value="${hornetq.remoting.netty.port:5445}"/>

            </acceptor>

         </acceptors>

       

       

         <cluster-connections>

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

                      <address>jms</address>

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

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

                      <reconnect-attempts>-1</reconnect-attempts>

                      <static-connectors allow-direct-connections-only="true">

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

                      </static-connectors>

              </cluster-connection>

         </cluster-connections>

       

       

         <paging-directory>${data.dir:../../data1}/paging</paging-directory>

         <bindings-directory>${data.dir:../../data1}/bindings</bindings-directory>

         <journal-directory>${data.dir:../../data1}/journal</journal-directory>

         <large-messages-directory>${data.dir:../../data1}/large-messages</large-messages-directory>

       

         <security-settings>

            <security-setting match="#">

               <permission type="createNonDurableQueue" roles="guest"/>

               <permission type="deleteNonDurableQueue" roles="guest"/>

                <permission type="createDurableQueue" roles="guest"/>

                <permission type="deleteDurableQueue" roles="guest"/>

                <permission type="consume" roles="guest"/>

               <permission type="send" roles="guest"/>

            </security-setting>

         </security-settings>

      </configuration>

       

      Can anybody pinpoint what's going wrong here?

        • 1. Re: HornetQ 2.3.0 Alpha replication
          borges

          I believe you are missing a connector to itself at the backup.

           

          There is an example at "examples/jms/replicated-transaction-failover".

           

          Let me know if that works or not.

           

          FWIW, the spelling error at the exception message was fixed some weeks ago.

          • 2. Re: HornetQ 2.3.0 Alpha replication
            amshaik

            Thanks Francisco. I added a connector to itself in both the live and back configs, and it worked.

            • 3. Re: HornetQ 2.3.0 Alpha replication
              amshaik

              But I'm still wondering, why exactly do the servers need a connector to themselves? How is it actually used?

              • 4. Re: HornetQ 2.3.0 Alpha replication
                clebert.suconic

                The backup needs to know how to connect to the live server.

                 

                There's some configuration being changed now by Andy Taylor.

                 

                 

                Any feedback on usuability is appreciated.

                • 5. Re: HornetQ 2.3.0 Alpha replication
                  amshaik

                  Thanks. My next step is to attempt to configure failback. I set <allow-failback> to true. And then, I noticed that the example uses a "failback-connector" element. For example:

                   

                  <failback-connector>

                           <factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>

                           <param key="host"  value="${hornetq.remoting.netty.host:myBackupHost}"/>

                           <param key="port"  value="${hornetq.remoting.netty.port:5446}"/>

                  </failback-connector>

                   

                  This is where I ran into trouble. Do I still need to specify a  <static-connector> in the <cluster-connection> tag?

                   

                  If so, how do I reference the failback-connector, given that it doesn't have a name attribute?

                  • 6. Re: HornetQ 2.3.0 Alpha replication
                    borges

                    0. While we very much appreciate you testing the waters of the Alpha, I need to warn you that the fail-back configuration and the backup configuration used in this alpha release were found to be not flexible enough, and were changed in our master repository (the merge took place today).

                     

                    On your specific questions, IIRC,

                     

                    1. You still need the previous configuration as it was, but now you also need the fail-back connector.

                    2. Unlike the other connector's this one does not have a name attribute.

                    • 7. Re: HornetQ 2.3.0 Alpha replication
                      wporter

                      Does the fail-back connector reside in the live server configuration only?  Does this need to be referenced in the cluster configuration or does just declaring it in the configuration section suffice?