RabbitMQ - Install Configure Manage
This Vagrantfile
and provision.sh
will create:
- 3 x RabbitMQ nodes:
- Specified RabbitMQ software installed.
- Configured as a single cluster.
- 2 x client nodes:
- Pika (Python RabbitMQ client) installed.
- Used to run producer/consumer scripts.
Eralng and RabbitMQ packages are automatically installed from here:
Note: You need to be in the rabbitmq-icm
directory to run all vagrant
commands!
-
Install Vagrant:
-
Install VirtualBox and VirtualBox Extension Pack
-
Clone this repo:
cd ~/workspace git clone https://github.com/stephendotcarter/rabbitmq-icm cd rabbitmq-icm
-
Download the required Vagrant box and update to latest:
vagrant box add ubuntu/xenial64 vagrant box update --box ubuntu/xenial64
-
Verify VirtualBox networks:
- Open VirtualBox.
- Click
Global Tools
. - Verify the
vboxnet0
IP address is192.168.56.1/24
.- If not then either:
- Change
vboxnet0
to be192.168.56.1/24
.
- Change
- or:
- Change VM IPs in
Vagrantfile
to match the same subnet asvboxnet0
. - Change the
hosts
file to reflect the new VM IPs
- Change VM IPs in
- If not then either:
-
Modify the variables in
provision.sh
as needed:// Should match exact version number from PackageCloud RabbitMQ repo RABBITMQ_VERSION=3.7.7-1 // Username and password for admin user RABBITMQ_USERNAME=admin RABBITMQ_PASSWORD=changeme // Erlang cookie to be used by the nodes RABBITMQ_ERLANG_COOKIE=bugsbunny
-
Create and configure the VMs:
vagrant up
-
Verify the VMs are running:
vagrant status
-
SSH to a node:
vagrant ssh rabbitmq1
-
Verify the RabbitMQ cluster is running using
rabbitmqctl
:sudo rabbitmqctl cluster_status
-
Verify the RabbitMQ cluster is running using the Management Plugin web interface:
- http://192.168.56.11:15672
- Log in using the username/password set in
provision.sh
-
Run the producer script to send some messages a queue:
vagrant ssh client1 bash /vagrant/sample_producer.sh
-
Run the consumer script to consumer the messages from the queue:
vagrant ssh client1 bash /vagrant/sample_consumer.sh
-
Modify the variables in
sample_producer.sh
andsample_consumer.sh
as needed. -
Destroy the VMs:
vagrant destroy -f