1 Deployment Description
1.1 Environment Preparations
The IP address | The host name | The operating system | use | Software version |
---|---|---|---|---|
192.168.15.12 | mq01 | Centos 7.8 | Disk node | The rabbitmq server – 3.8.3 and Erlang – 22.3.4, socat – 1.7.3.2 |
192.168.15.13 | mq02 | Centos 7.8 | The memory node |
1.2 Configuring the Host and hosts files
- Change the host names of the two MQ nodes mq01, mq02.
[root@mq01 ~]# vim /etc/hostname
Mq01 // The other one changed to MQ02
- Then modify the hosts configuration file.
[root@mq01 ~]# vim /etc/hosts
192.168.15.12 mq01
192.168.15.13 mq02
127.0.0.1 MQ01 // The other one is 127.0.0.1 MQ02
::1 MQ01 // The other one is ::1 MQ02
1.3 Installing Basic Components
1.3.1 Installing Rabbitmq-Server and Erlang
- Downloading software Packages
Packagecloud. IO/rabbitmq/er…
Github.com/rabbitmq/ra…
www.rabbitmq.com/rabbitmq-re…
www.dest-unreach.org/socat/downl…
Once downloaded, upload to the current folder
- Install Erlang
Yum localinstall Erlang 22.3.4-1. El7. X86_64. RPM
- Install Socat dependencies
The tar ZXVF socat – 1.7.3.2. Tar. Gz
CD socat – 1.7.3.2
./configure
make && make install
- Install the Rabbitmq server. –
rpm –import rabbitmq-release-signing-key.asc
Yum localinstall the rabbitmq server – 3.8.3-1. El7. Noarch. RPM
1.3.2 Service Management
- Start the service
systemctl start rabbitmq-server
- Copy the erlang.cookie of MQ01 to another host
/ root @ mq01 ~ # SCP/var/lib/rabbitmq /. Erlang. The cookie [email protected]: / var/lib/rabbitmq /. Erlang. Cookies
/ root @ mq01 ~ # SCP/root /. Erlang. The cookie [email protected]: / root /. Erlang. Cookies
[root@mq02 ~]# systemctl restart rabbitmq-server
- Add WEB management services
/usr/lib/rabbitmq/bin/rabbitmq-plugins enable rabbitmq_management
service rabbitmq-server start
1.4 Joining a Cluster
- Mq02 pauses RabbitMQ first
[root@mq02 ~]# rabbitmqctl stop_app
- Add MQ02 to the cluster
[root@mq02 ~]# rabbitmqctl reset
[root@mq02 ~]# rabbitmqctl join_cluster –ram rabbit@mq01
Clustering node rabbit@mq02 with rabbit@mq01
[root@mq02 ~]# rabbitmqctl start_app
- Viewing Cluster Status
rabbitmqctl cluster_status
1.5 Logging In to the WEB Console
1.5.1 Modifying the Login Configuration File
Vim/usr/lib/rabbitmq/lib/rabbitmq_server – 3.8.3 ebin/rabbit. The app
Change {loopback_users, [<< “guest” >>]} in Rabbit. app to {loopback_users, []}
systemctl restart rabbitmq-server
1.5.2 login
Open the browser and enter http://nodeip:15672. Enter the default Username: guest and the default Password: guest.
2 Rabbimq Mirroring cluster deployment description
2.1 Creating a RabbitMQ Policy
Create policies on the console of the MQ01 node
(1) Click the Admin menu – > Policies on the right – > Add/ Update a policy at the bottom of the left.
Definition set the ha-mode to all, and set the cluster to mirror mode
(3) Click Add Policy.
Name: indicates the Name of the policy
Pattern: Matching Pattern of exchanges or queue names (regular expression)
Definition: Mirror Definition, which includes three parts: ha-mode, ha-params, and ha-sync-mode
Ha-mode: specifies the mode of the mirror queue. The valid value is “all”, “exactly”, and “Nodes”
All: mirrors all nodes in the cluster.
Priority: Specifies the Priority of the policy
2.2 Creating a Queue
Add queues on the console of the MQ01 node
Click On the Queues menu – > Add a new Queue below the left side.
(2) Enter parameters and click Add Queue.