1. Introduction
1.1. Official website: https://www.rabbitmq.com/
2. Installation and configuration:
See: Https://docs.openstack.org/ha-guide/shared-messaging.html#rabbitmq-configure
2.1. Install: Do it on each node
Installed directly with Yum, the installation package is available in OpenStack's Yum source
Yum Install Rabbitmq-server
Start Service (Confirm cookie file has been generated)
[Email protected] ~]# systemctl start rabbitmq-server[[email protected] ~]# ll/var/lib/rabbitmq/. Erlang.cookie-r--------1 rabbitmq rabbitmq Dec
Create user
#前面的openstack是用户名, the back of OpenStack is the password rabbitmqctl add_user OpenStack OpenStack
Creating user "OpenStack" ...
assigning permissions
Rabbitmqctl set_permissions OpenStack ". *" ". *" ". *" Setting Permissions for the user "OpenStack" in Vhost "/" ...
Stop RABBITMQ
Systemctl Stop Rabbitmq-server
2.2. Configuration
On node 01, SCP the cookie file to a further two nodes
Scp/var/lib/rabbitmq/.erlang.cookie [email protected]:/var/lib/rabbitmq/.erlang.cookiescp/var/lib/rabbitmq/. Erlang.cookie [Email Protected]:/var/lib/rabbitmq/.erlang.cookie
Modify permissions on node 02/03, respectively
# chown rabbitmq:rabbitmq/var/lib/rabbitmq/.erlang.cookie# chmod 400/var/lib/rabbitmq/.erlang.cookie
Start the Service on node 01 and view the cluster status
[[email protected] ~]# systemctl start rabbitmq-server.service[[email protected] ~]# rabbitmqctl Cluster_statuscluster Status of node [email protected] ... [{Nodes,[{disc,[[email protected]}]}, {Running_nodes,[[email protected]}, {cluster_name,<< "[email protected ] ">>}, {partitions,[]}, {Alarms,[{[email protected],[]}]}]
Start the service on nodes 02 and 03, stop the native service, join the 01 cluster (after successfully joining, start the service without executing Stop_app)
[Email protected] ~]# systemctl start rabbitmq-server[[email protected] ~]# rabbitmqctl stop_appstopping node [email prot Ected] ... [Email protected] ~]# rabbitmqctl join_cluster--ram [email protected]clustering node [email protected] with [email prote CTED] ...
[Email protected] ~]# systemctl stop rabbitmq-server[[email protected] ~]# chown rabbitmq:rabbitmq/var/lib/rabbitmq/. Erlang.cookie[[email protected] ~]# chmod 400/var/lib/rabbitmq/.erlang.cookie[[email protected] ~]# systemctl start Rabbitmq-server[[email protected] ~]# rabbitmqctl stop_appstopping node [email protected] ... [Email protected] ~]# rabbitmqctl join_cluster--ram [email protected]clustering node [email protected] with [email prote CTED] ...
viewing status on a 01 node
[Email protected] ~]# rabbitmqctl cluster_statuscluster Status of node [email protected] ... [{Nodes,[{disc,[[email protected]}, {ram,[[email protected],[email protected]}]}, {Running_nodes,[[email Protected],[email protected], [email protected]}, {cluster_name,<< "[email protected]" >>}, { Partitions,[]}, {Alarms,[{[email protected],[]}, {[email protected],[]}, { [email protected],[]}]
Must ensure that you can see three nodes, I in the configuration process occurred the following error, multiple restarts several times better, and then come back to study it
[Email protected] ~]# rabbitmqctl join_cluster--ram [email protected]clustering node [email protected] with [email prote CTED] ... Error: {inconsistent_cluster, "Node [email protected] thinks it ' s clustered with Node [email protected], but [email protect Ed] disagrees "}
Configure HA mode, I do not quite understand the official document meaning, but it seems that this configuration can implement the HA mode, the message can be mirrored to other nodes
Rabbitmqctl set_policy ha-all ' ^ (?! Amq\.). * ' {' ha-mode ': ' All '} '
"Linux" "Services" "IaaS" openstack-pike (3. Building a highly available message queue)