38.2. Dedicated Symmetrical Live and Backup Clusters
Note
$JBOSS_HOME/extras/hornetq/resources/examples/cluster-with-dedicated-backup
.
Example 38.3. Single Instance, Pure JMS, Dedicated Symmetrical Configuration
- Dedicated JCA Server, as described in Example 38.4, “Dedicated JCA Server”
- Remote JCA Server, as described in Example 38.5, “Remote JCA Server”.
38.2.1. Dedicated JCA Live Server
Example 38.4. Dedicated JCA Server
Procedure 38.7. Create Dedicated Live Server Profile
Important
production
profile to customize the live server configuration.
Important
- Navigate to
$JBOSS_HOME/server/
- Copy the
production
profile, and rename it toHornetQ_Dedicated
Procedure 38.8. Configure Shared Store and Journaling
- Navigate to
$JBOSS_HOME/server/HornetQ_Dedicated/deploy/hornetq/
- Open
hornetq-configuration.xml
- Add the <shared-store> element as a child of the <configuration> element.
<shared-store>true</shared-store>
- Ensure the bindings, journal, and large messages path locations are set to a location the live backup group can access.You can set absolute paths as the example describes, or use the JBoss parameters that exist in the configuration file.If you choose the parameter option, and you do not use the default paths that these parameters resolve to, you must specify the path your bindings, journal, and large messages reside in each time you start the server.
<large-messages-directory>/media/shared/data/large-messages</large-messages-directory> <bindings-directory>/media/shared/data/bindings</bindings-directory> <journal-directory>/media/shared/data/journal</journal-directory> <paging-directory>/media/shared/data/paging</paging-directory>
Note
Ensure you specify paths that are accessible to the live backup groups on your network.
Procedure 38.9. Configure JMS Client Graceful Shutdown
- Navigate to
$JBOSS_HOME/server/HornetQ_Dedicated/deploy/hornetq/
- Open
hornetq-configuration.xml
- Specify the <fail over-on-shutdown> element in the area near the journal directory configuration in Procedure 38.2, “Configure Shared Store and Journaling”.
<failover-on-shutdown>true</failover-on-shutdown>
Note
You are not constrained where you put the element in thehornetq-configuration.xml
file, however it is easier to find the less detailed settings if they are all located at the top of the file. - Save and close the file.
Procedure 38.10. Configure HA Connection Factories
- Navigate to
$JBOSS_HOME/server/HornetQ_Dedicated/deploy/hornetq/
- Open
hornetq-jms.xml
. - Add the following attributes and values as specified below.
- <ha>true</ha>
- Specifies the client must support high availability, and must always be true for fail over to occur.
- <retry-interval>1000</retry-interval>
- Specifies how long the client must wait (in milliseconds) before it can reconnect to the server.
- <retry-interval-multiplier>1.0</retry-interval-multiplier>
- Specifies the multiplier <retry-interval> uses for each subsequent reconnection pauses. By setting the value to
1.0
, the retry interval is the same for each client reconnection request. - <reconnect-attempts>-1</reconnect-attempts>
- Specifies how many reconnect attempts a client should make before failing. Setting
-1
means unlimited reconnection attempts.
<?xml version='1.0' encoding='UTF-8'?> <configuration xmlns="urn:hornetq" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:hornetq /schema/hornetq-jms.xsd"> <connection-factory name="NettyConnectionFactory"> <xa>true</xa> <connectors> <connector-ref connector-name="netty"/> </connectors> <entries> <entry name="/ConnectionFactory"/> <entry name="/XAConnectionFactory"/> </entries> <ha>true</ha> <!-- Pause 1 second between connect attempts --> <retry-interval>1000</retry-interval> <!-- Multiply subsequent reconnect pauses by this multiplier. This can be used to implement an exponential back-off. For our purposes we just set to 1.0 so each reconnect pause is the same length --> <retry-interval-multiplier>1.0</retry-interval-multiplier> <!-- Try reconnecting an unlimited number of times (-1 means unlimited) --> <reconnect-attempts>-1</reconnect-attempts> </connection-factory> </configuration>
- Define new queues in both master and backup nodes by adding one of the following configuration blocks to the specified file.For
production/deploy/hornetq/hornetq-jms.xml
<queue name="testQueue"> <entry name="/queue/testQueue"/> <durable>true</durable> </queue>
Forproduction/deploy/customName-hornetq-jms.xml
Note
Ensure the file is well-formed from an XML validation perspective by ensure the XML Namespace is present and correct in the file as specified.<configuration xmlns="urn:hornetq" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:hornetq /schema/hornetq-jms.xsd"> <queue name="testQueue"> <entry name="/queue/testQueue"/> <durable>true</durable> </queue> </configuration>