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

How to build a highly available cluster environment for RabbitMq under CentOS

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

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces the relevant knowledge of "how to build a RabbitMq high availability cluster environment under CentOS". The editor shows you the operation process through an actual case. The operation method is simple, fast and practical. I hope this article "how to build a RabbitMq high availability cluster environment under CentOS" can help you solve the problem.

Preparatory work

1. Prepare two or more servers with rabbitmq-server services installed

I have prepared two here, one of which is as follows:

192.168.40.130 rabbitmq01

192.168.40.131 rabbitmq02

2. Make sure the firewall is off. 3. References on the official website

Hosts mapping

Modify the hosts file (path: / etc/hosts) on each service and set it as follows:

192.168.40.130 rabbitmq01

192.168.40.131 rabbitmq02

Modify erlang cookie

To build a cluster, you must modify the erlang cookie of each cluster node to the same value.

For the centos,erlang.cookie file, under / root/.erlang.cookie.

Modify the erlang cookie of rabbitmq01

Modify the erlang cookie of rabbitmq02

Note: the permission of .erlang.cookie is 400 by default, so you need to change the permission to allow modification, and then restore it to 400. otherwise, you will report an error when starting rabbitmq-server.

The default permission is 400, as shown in the following figure.

Modify the permission to 660, as shown in the following figure.

After modification, restart the server!

Set up a cluster

1. Check the cluster status of each server first.

Use the command: rabbitmqctl cluster_status

Rabbitmq01:

There is currently only one node.

Rabbitmq02:

There is currently only one node.

2. Add (join) node

Now you want to put the rabbitmq02 join on the node rabbitmq01.

3. Check the cluster status of the server again

Use the command: rabbitmqctl cluster_status

Server rabbitmq01:

Server rabbitmq02:

This is the end of the content about "how to build a high availability cluster environment for RabbitMq under CentOS". Thank you for your reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.

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

Development

Wechat

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

12
Report