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

Configuration of rabbitMQ cluster

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

Share

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

Configuration of rabbitMQ cluster

Reference document: http://blog.csdn.net/woogeyu/article/details/51119101

Environment description

Create two node host IP on two different hosts with the following host name

10.176.0.13 node1

10.176.0.19 node2

1. Install rabbitMQ (one rabbitMQ for each host) on two hosts, and note that the versions of the locale erlang and rabbitMQ must be the same

two。 Configuration of the cluster

All the nodes in the RabbitMQ cluster are equal, there is no absolute distinction between primary and secondary, and the configuration information of each node will be synchronized in the cluster. Only the node type is different, there are disk type and RAM type. Corresponding to disk and memory, disk nodes can persist messages with high security, and RAM nodes can access messages quickly, but they cannot be persisted. There must be at least one disk type node in a cluster to persist messages in the persistence queue when all nodes are down and restarted.

Problem description: RabbitMQ requires at least one disk node in the cluster, and all other nodes can be memory nodes. When a node joins or leaves the cluster, the change must be notified to at least one disk node. If the only disk node in the cluster crashes, the cluster can still keep running, but nothing else can be done (add, delete, change and check) until the node is restored.

Solution: set up two disk nodes, at least one of which is available, to save metadata changes.

2.1 prepare for installation, resolve the host names to each other, and modify the hosts files of the two hosts respectively

Vim / etc/hosts adds the following

192.168.31.66 node1

192.168.31.67 node2

2.2 synchronous Erlang Cookie (nodes communicate through Erlang Cookie files Erlang Cookie is a key that ensures that different nodes can communicate with each other to achieve synchronization of configuration information) replace any cookie file or content with other machines in the cluster. Finally, make sure the file permission is 400.

View the cookie value of the node1 node

[root@node1 ~] # cat / var/lib/rabbitmq/.erlang.cookie

PSNXAHYXQRPBKUVNYQCU

Close node2 and copy the value of node1's cookie to the node2 node

[root@node2 ~] # rabbitmqctl stop

[root@node2 ~] # echo PSNXAHYXQRPBKUVNYQCU > / var/lib/rabbitmq/.erlang.cookie

After the cookie values are synchronized, start the node2 node

Service rabbitmq-server start

2.3 add node1 to the cluster node2 as a RAM type node

Rabbitmqctl stop_app

Rabbitmqctl reset

Rabbitmqctl join_cluster rabbit@node1-ram

Rabbitmqctl start_app

2.4 View the status of the cluster

Rabbitmqctl status

Rabbitmqctl cluster_status

3 visit any management interface to view http://ip:15672 to view cluster information

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