How to Setup RabbitMQ Cluster for vCloud Director 9.7?

Step 1 Prerequisites

In this post, I will show you how to set RabbitMQ Cluster for vCloud Director 9.7 on CentOS7

  • 2 or more CentOS 7 Server. In my case, I setup up 2 nodes.
    • AMQP-01: 10.0.0.11
    • AMQP-02: 10.0.0.12
  • Ensure that 2 nodes can ping to each other’s over DNS.
  • Root privileges.

Step 2 – Install RabbitMQ Server

yum -y update 

First, install the Extra Packages for Enterprise Linux (EPEL):

yum install -y epel-release

Create the repo file (/etc/yum.repos.d/rabbitmq_erlang.repo) with the following contents:

vi /etc/yum.repos.d/rabbitmq_erlang.repo
[rabbitmq_erlang]
name=rabbitmq_erlang
baseurl=https://packagecloud.io/rabbitmq/erlang/el/7/$basearch
repo_gpgcheck=1
gpgcheck=1
enabled=1
# PackageCloud's repository key and RabbitMQ package signing key
gpgkey=https://packagecloud.io/rabbitmq/erlang/gpgkey
       https://dl.bintray.com/rabbitmq/Keys/rabbitmq-release-signing-key.asc
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300
 
[rabbitmq_erlang-source]
name=rabbitmq_erlang-source
baseurl=https://packagecloud.io/rabbitmq/erlang/el/7/SRPMS
repo_gpgcheck=1
gpgcheck=0
enabled=1
# PackageCloud's repository key and RabbitMQ package signing key
gpgkey=https://packagecloud.io/rabbitmq/erlang/gpgkey
       https://dl.bintray.com/rabbitmq/Keys/rabbitmq-release-signing-key.asc
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
metadata_expire=300

Then, install the package:

yum install erlang -y

Next, download the rpm for rabbitmq selecting the desired release from the official Github repo. In my case, I used release 3.8.9:

yum install -y wget
wget https://github.com/rabbitmq/rabbitmq-server/releases/download/v3.8.9/rabbitmq-server-3.8.9-1.el6.noarch.rpm

Import the RabbitMQ public signing certificate:

rpm -import https://www.rabbitmq.com/rabbitmq-signing-key-public.asc

Now, install the rabbitmq package

yum install -y rabbitmq-server-3.8.9-1.el6.noarch.rpm

Enable and start the service

chkconfig rabbitmq-server on
systemctl start rabbitmq-server
systemctl enable rabbitmq-server

The following command shows the rabbitMQ server status:

systemctl status rabbitmq-server

Step 3 – Configure CentOS Firewalld

firewall-cmd --add-port=15672/tcp --permanent
firewall-cmd --add-port=5672/tcp --permanent
firewall-cmd --add-port={4369/tcp,25672/tcp} --permanent
firewall-cmd --reload
firewall-cmd --list-all

Step 4 – Enable RabbitMQ Management Plugins

Run the following commands to enable the management plugins:

rabbitmq-plugins enable rabbitmq_management
systemctl restart rabbitmq-server

Repeat from Step 2 to  Step 4 on Node 02

Step 5 – Set up RabbitMQ Cluster

Node 01:

Capture the content of the erlang cookie:

more /var/lib/rabbitmq/.erlang.cookie

[[email protected] ~]# more /var/lib/rabbitmq/.erlang.cookie

GKBMSGPFIUOZDQPQNJZQ

Node 02

systemctl stop rabbitmq-server
echo GKBMSGPFIUOZDQPQNJZQ > /var/lib/rabbitmq/.erlang.cookie
chown -R rabbitmq:rabbitmq /var/lib/rabbitmq/*
systemctl restart rabbitmq-server
rabbitmqctl stop_app
rabbitmqctl reset

Now let RabbitMQ server on both nodes join the cluster on ‘node01’, then start the app.

rabbitmqctl join_cluster [email protected]
rabbitmqctl start_app

After it’s complete, check the RabbitMQ cluster status.

rabbitmqctl cluster_status

The RabbitMQ Cluster has been created, with node01, node02 as members and you will get the results as shown below.

Finally, set the HA policy with the following command (Run on any nodes)

rabbitmqctl set_policy ha-all "" '{"ha-mode":"all","ha-sync-mode":"automatic"}'

Step 6 – Create a New Administrator User

Finally, run the following commands to create the vcloud user with administrative privileges (Run on any nodes)

rabbitmqctl add_user vcloud VMware1!
rabbitmqctl set_user_tags vcloud administrator
rabbitmqctl set_permissions -p / vcloud ".*" ".*" ".*"

Check Status on Management Console

https://any_nodes_ipaddress:15672 with credential created in step 6

Step 7 – Load Balancer – NSX Edge

Comming Soon

Leave a Reply

Your email address will not be published. Required fields are marked *