ActiveMQ HA solution based on shared file system

Source: Internet
Author: User

ActiveMQ HA solution based on shared file system

ActiveMQ HA solution based on shared file system

Configure NFS server

Yum install nfs-utils rpcbind

Set the shared directory and edit/etc/exports

/Home/mq1_data 192.168.41.199 (rw, sync, no_root_squash)
/Home/mq1_data 192.168.41.199 (rw, sync, no_root_squash)

Start the NFS server

Service rpcbind start
Chkconfig rpcbind on
Service nfs start
 
 
Configure NFS client

Yum install nfs-utils portmap (for CentOS 5)
Yum install nfs-utils rpcbind (for centos 6)

Check the file system that can be mounted

Showmount-e 192.168.188.143

Mount a File System

Mount-t nfs 192.168.188.143:/home/mq1_data/home/mq1_data-o nolock
 
Adjust the configuration file of message-oriented Middleware

Modify activemq. xml

<PersistenceAdapter>
<KahaDB directory = "/home/mq1_data"/>
</PersistenceAdapter>
 
 
Use failover as the connection string

ConnectionFactory connectionFactory = new ActiveMQConnectionFactory (
ActiveMQConnection. DEFAULT_USER,
ActiveMQConnection. DEFAULT_PASSWORD,
"Failover :( tcp: // 192.168.41.197: 61616, tcp: // 192.168.41.198: 61616 )");
Principle

The principle based on the shared file system is still relatively simple, because activemq locks the lock file at startup. When the Master is up, slaver will naturally wait there.

When the Master falls down, the lock of the lock file will be released, and one of the slaver will lock the lock file, which will exist as the Master.

When the fallen Master is up, the lock file is locked, so it can only be slaver, as for data .. Shared storage, data is there anyway

Recommended reading:

ActiveMQ installation in Linux

ACTIVEMQ server in Ubuntu

Error solving when ActiveMQ is started in CentOS 6.5

Spring + JMS + ActiveMQ + Tomcat Implement Message Service

Set ActiveMQ port and WEB port in Linux

This article permanently updates the link address:

Related Article

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.