Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Example Analysis of Master-Slave + Broker Cluster Mode of ActiveMQ Cluster

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

ActiveMQ cluster Master-Slave + Broker Cluster model example analysis, I believe that many inexperienced people are helpless, for this reason this article summarizes the causes of the problem and solutions, through this article I hope you can solve this problem.

I. Introduction

Master-Slave Cluster:

It consists of at least three nodes, one Master node and the other Slave nodes. Only the Master node provides services to the outside world, and the Slave node is in a waiting state. When the master node goes down, the slave node will elect a node to become the new Master node and continue to provide services.

The advantage is that it can solve the high availability problem of multi-service hot standby, and the disadvantage is that it cannot solve the problems of Load Balancer and Distribution.

Broker Cluster:

Broker-Cluster deployment is where brokers are connected to each other via a network and share queues. When a message is received in queue-A specified above broker-A and is pending, and no consumer is connected to broker-A at this time. If there is a consumer consuming messages from queue-A on broker-B in the cluster, broker-B will first obtain messages from broker-A through the internal network and notify its own consumers to consume.

the advantage is that that problem of Load Balancer and distribution can be solved. High availability is not supported.

The perfect solution is to combine the two.

II. Preparations

1. Cluster planning:

Broker-a

cluster members

port

openwire

amqp

stomp

mqtt

ws

Admin Port

192.168.2.86

192.168.2.87

192.168.2.88

61619

5675

61643

1886

61644

8191

Broker-b

cluster members

port

openwire

amqp

stomp

mqtt

ws

Admin Port

192.168.2.86

192.168.2.87

192.168.2.88

61719

6675

61743

2886

61744

8291

2. Download MQ installation package:

http://archive.apache.org/dist/activemq/5.14.4/apache-activemq-5.14.4-bin.tar.gz

3. Install JDK

yum -y install java-1.7.0-openjdk*

Cluster Installation 3.1. Configure Master-Slave

192.168.2.86 operating on

Extract the installation package

tar -zxf apache-activemq-5.14.4-bin.tar.gz

mv apache-activemq-5.14.4 activemq-cluster1 #broker-a cluster

cp -r activemq-cluster1 activemq-cluster2 #broker-b cluster

Master-Slave is based on Zookeeper.

Modify the activemq.xml file for activemq-cluster1

vi activemq-cluster1/conf/activemq.xml

Broker-A's configuration:

Modify the activemq.xml file for activemq-cluster2

vi activemq-cluster2/conf/activemq.xml

Broker-B configuration:

BrokerName is considered to be the same Master-Slavecluster, and at least 3 will succeed, otherwise the master cannot be selected, resulting in no broker to provide services.

3.2 Configure Broker Cluster

Add the following to the broker-a profile:

Add the following to the broker-b profile:

Then copy the activemq-cluster1 and activemq-cluster2 directories to 192.168.2.87, 192.168.2.88 respectively

scp -r activemq-cluster1/ 192.168.2.87:~/

scp -r activemq-cluster1/ 192.168.2.88:~/

scp -r activemq-cluster2/ 192.168.2.87:~/

scp -r activemq-cluster2/ 192.168.2.88:~/

3.3 Start cluster

Start broker-a (3 nodes) and broker-b (3 nodes)

Each server executes the following command:

activemq-cluster1/bin/activemq start

activemq-cluster2/bin/activemq start

Check the logs to see 2 broker logs directly linked

Broker-a

INFO | Successfully connected to tcp://192.168.2.87:61719

INFO | Network connection between vm://broker-a#0 andtcp://192.168.2.87:61719 (broker-b) has been established.

Broker-b

Network connection between vm://broker-b#6and tcp://192.168.2.88:61619 (broker-a) has been established. |

After reading the above content, do you have the method of example analysis of ActiveMQ cluster Master-Slave + Broker Cluster pattern? If you still want to learn more skills or want to know more related content, welcome to pay attention to the industry information channel, thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report