U1.12 Ubuntu Quick Start (QS): RabbitMq Cluster - chempkovsky/CS2WPF-and-CS2XAMARIN GitHub Wiki

Important note

Read before we begin

Preliminary steps

  • repeat the steps of the article RabbitMq deploy to host
  • as a result, we have two RabbitMq servers deployed on two virtual machines

IP addresses

u200401 virtual machine

  • Step 1: for u200401 show ip address
    • run the command "ip a"
Click to show the picture

picture

u200402 virtual machine

  • Step 2: for u200402 show ip address
    • run the command "ip a"
Click to show the picture

picture

hosts files

  • /etc/hosts files

u200401 virtual machine

  • Step 3: modify /etc/hosts as shown below
    • run the command
sudo nano /etc/hosts
Click to show the picture

picture

u200402 virtual machine

  • Step 4: modify /etc/hosts as shown below
    • run the command
sudo nano /etc/hosts
Click to show the picture

picture

erlang cookie files

  • /var/lib/rabbitmq/.erlang.cookie files
  • Note: the cookie must be the same on both servers

u200401 virtual machine

  • Step 5: modify /var/lib/rabbitmq/.erlang.cookie as shown below
    • run the command
sudo nano /var/lib/rabbitmq/.erlang.cookie
Click to show the picture

picture

u200402 virtual machine

  • Step 6: modify /var/lib/rabbitmq/.erlang.cookie as shown below
    • run the command
sudo nano /var/lib/rabbitmq/.erlang.cookie
Click to show the picture

picture

Restart rabbitmq servers

u200401 virtual machine

  • Step 7: run the command
sudo systemctl restart rabbitmq-server

u200402 virtual machine

  • Step 8: run the command
sudo systemctl restart rabbitmq-server

Having the same cookie

  • Step 9: On both machines run diagnostics commands:
sudo rabbitmq-diagnostics -n rabbit@u200401 ping
sudo rabbitmq-diagnostics -n rabbit@u200402 ping
sudo rabbitmq-diagnostics -n rabbit@u200401 check_running
sudo rabbitmq-diagnostics -n rabbit@u200402 check_running

Detaching

  • Step 10: On both machines run the command:
sudo rabbitmq-server -detached
sudo rabbitmqctl cluster_status

Creating a Cluster

u200402 virtual machine

  • Step 11: run the commands
sudo rabbitmqctl stop_app
sudo rabbitmqctl reset
sudo rabbitmqctl join_cluster rabbit@u200401
sudo rabbitmqctl start_app
Click to show the picture

picture

sudo rabbitmqctl cluster_status
Click to show the picture

picture

Make the second test

u200401 virtual machine

  • using browser go to
http://localhost:15672/
  • here is a result
Click to show the picture

picture

⚠️ **GitHub.com Fallback** ⚠️