HORNETQ Master and slave configuration

Source: Internet
Author: User
Tags failover

Message must be persisted

Primary service-side configuration file:

Hornetq-configure.xml add

Persistent configuration
<persistence-enabled>true</persistence-enabled>

Connectors for connecting to the backup server

<backup-connector-ref connector-name= "Backup-connector"/>

<connectors>

......

Standby connectors

<connector name= "Backup-connector" >
<factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
<param key= "host" value= "172.20.16.191"/>
<param key= "Port" value= "5445"/>
</connector>

</connectors>

Hornetq-jms.xml add

Add property backup-connector-name to Connection-factory.connectors.connector-ref.

Add Failover-on-server-shutdown in Connection-factory and set to true to indicate failure relief when ctrl-c stops the server.

Specific configuration See below:

<connection-factory name= "Nettyconnectionfactory" >
<connectors>
<connector-ref connector-name= "Netty" backup-connector-name= "Backup-connector"/>
</connectors>
<entries>
<entry name= "ConnectionFactory"/>
<entry name= "/xaconnectionfactory"/>
</entries>
<failover-on-server-shutdown>true</failover-on-server-shutdown>
</connection-factory>

From the server-side configuration file:

Hornetq-configure.xml add

Persistent configuration
<persistence-enabled>true</persistence-enabled>

is a backup server

<backup>true</backup>

Note:

1, first start from the service side, and then start the main service side.

2, the master and subordinate data to be consistent.

3, the above configuration is to use data replication to ensure that the master-slave data consistency, there is another way is storage sharing, using storage sharing is required in the master-slave server Hornetq-configure.xml to add the following configuration:

Whether to share storage

<shared-store>true</shared-store>

Data directory set to shared directory

<paging-directory>shared-dir/data/paging</paging-directory>

<bindings-directory>shared-dir/data/bindings</bindings-directory>

<journal-directory>shared-dir/data/journal</journal-directory>

<large-messages-directory>shared-dir/data/large-messages</large-messages-directory>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.