Hornetq Master/Slave Configuration

Source: Internet
Author: User

Message must be persistent

 

Master server configuration file:

 

Hornetq-configure.xml add

 

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

 

// Connector used to connect to the backup server

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

 

<Connectors>

......

// Backup Connector

<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 the property backup-connector-name in the connection-factory.connectors.connector-ref.

Add Failover-on-server-shutdown in connection-factory and set it to true, which indicates that the rescue will fail when Ctrl-C stops the server.

The specific configuration is as follows:

 

<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>

 

Slave server configuration file:

 

Hornetq-configure.xml add

 

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

 

// Whether it is a backup server

<Backup> true </backup>

 

Note:

1. Start the slave server first, and then start the master server.

2. Data on the master and slave sides must be consistent.

3. The above configuration uses data replication to ensure master-slave data consistency, there is also a way of storage sharing, the use of storage sharing is to add the following configuration in the master-slave server hornetq-configure.xml:

// Whether to share Storage

<Shared-store> true </Shared-store>

// Set the data directory to a 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.