Set up the high-availability cluster environment of RabbitMq in CentOS, and set up centosrabbitmq
Preparations 1: Prepare two or more servers with the rabbitmq-server service installed.
I have prepared the following two servers:
192.168.40.130 rabbitmq01
192.168.40.131 rabbitmq02
2. Make sure that the firewall is disabled. 3. Official website references
Http://www.rabbitmq.com/clustering.html
Hosts ing
Modify the hosts file (Path:/etc/hosts) on each service and set it to the following:
192.168.40.130 rabbitmq01
192.168.40.131 rabbitmq02
Modify Erlang Cookie
To build a cluster, you must change the Erlang cookie of each cluster node to the same value.
For CentOS, the erlang. cookie file is under/root/. erlang. cookie.
Modify the Erlang cookie of rabbitmq01
Modify the Erlang cookie of rabbitmq02
Note: The default value is. erlang. the cookie permission is 400. Therefore, you must first change the permission to allow modification, and then restore the permission to 400. Otherwise, an error will be reported when rabbitmq-server is started.
The default permission is 400, for example.
Change the permission to 660, as shown in.
After modification, restart the server!
Set up cluster 1. First, check the cluster status of each server.
Command: rabbitmqctl cluster_status
Rabbitmq01:
Currently, there is only one node.
Rabbitmq02:
Currently, there is only one node.
2. Add (join) nodes
Join rabbitmq02 to the node rabbitmq01.
3. Check the cluster status of the server again.
Command: rabbitmqctl cluster_status
Server rabbitmq01:
Server rabbitmq02: