The default OpenStack uses RABBITMQ for information queuing, and if you want to be cloud high, you need to have a highly available configuration for each of the components involved, and this article focuses on how to use RABBITMQ for high availability.
The highly available methods are:
Through the distributed nature of Erlang (through the Magic Cookie Authentication node) for the RabbitMQ cluster, each RabbitMQ service is a peer node, that is, each node provides services to the client connection for sending and receiving messages. These nodes replicate the message queue structure through the RabbitMQ HA queue (mirror queue). In this scenario, 3 nodes are built, and all are disk nodes (all node states are consistent and nodes are fully equal), so long as any one node can work, the RabbitMQ cluster can provide services to the outside.
The environment is:
System CentOS 7.1
RABBITMQ version is 3.6.2
Host information
Node1 10.10.33.163node2 10.10.33.166node3 10.10.33.167
/etc/hosts configured to
10.10.33.163 ip-10-10-33-16310.10.33.166 ip-10-10-33-16610.10.33.167 ip-10-10-33-167
Here's how to start the installation
First, installation
Installing third-party libraries and RABBITMQ
Yum install-y Epel-releaseyum Install Rabbitmq-server
Start the service
Systemctl Enable Rabbitmq-server.servicesystemctl start Rabbitmq-server.service
Second, the configuration
Configure in Node1
Copy the/var/lib/rabbitmq/.erlang.cookie of Node1 to Node2 and Node3
Modify permissions (all nodes)
chmod 400/var/lib/rabbitmq/.erlang.cookiechown-r Rabbitmq:rabbitmq/var/lib/rabbitmq/.erlang.cookie
Configure in Node2
[Email protected] my.cnf.d]# rabbitmqctl stop_appstopping node ' [email protected] ' ... [Email protected] my.cnf.d]# rabbitmqctl join_cluster [email protected]clustering node ' [email protected] ' with ' [email p Rotected] ' ... You have new mail In/var/spool/mail/root[[email protected] my.cnf.d]# rabbitmqctl start_appstarting node ' [Email protecte D] ' ...
Configure in Node3
[Email protected] my.cnf.d]# rabbitmqctl stop_appstopping node ' [email protected] ' ... [Email protected] my.cnf.d]# rabbitmqctl join_cluster [email protected]clustering node ' [email protected] ' with ' [email p Rotected] ' ... [Email protected] my.cnf.d]# rabbitmqctl start_appstarting node ' [email protected] ' ...
View cluster status
[Email protected] my.cnf.d]# rabbitmqctl cluster_statuscluster Status of node ' [email protected] ' ... [{nodes,[{disc,[' [email protected] ', ' [email protected] ', ' [email protected] '}]}, {running_nodes,[' [email p Rotected] ', ' [email protected] ', ' [email protected] '}, {cluster_name,<< ' [email protected] ' >>}, {partitions,[]}, {alarms,[{' [email protected] ', []}, {' [email protected] ', []}, {' [email protected] ', []}] }]
Three, cluster high-availability configuration
Designing a mirrored queue policy
Execute at any one node
[[email protected] ~]# rabbitmqctl set_policy ha-all ' ^ (?! Amq\.). * ' {' ha-mode ': ' All '} ' Setting policy ' ha-all ' for pattern ' ^ (?! Amq\\.). * "to" {\ "ha-mode\": \ "All\"} "with priority" 0 "...
This article is from the "Yin-Technical Exchange" blog, please be sure to keep this source http://dl528888.blog.51cto.com/2382721/1864895
RABBITMQ High availability of enterprise private cloud