RabbitMQ installation

Document version: 245. Automatically generated.

๐Ÿ“˜

RabbitMQ is an open-source message-broker software (sometimes called message-oriented middleware)

It was originally implemented the Advanced Message Queuing Protocol (AMQP) and has since been extended with a plug-in architecture to support Streaming Text Oriented Messaging Protocol (STOMP), MQ Telemetry Transport (MQTT), and other protocols.

RabbitMQ 3.8 is used for asynchronous communication between applications.

Prerequisites

Conventions

  • CAPITAL_LETTERS_VARIABLE_NAME - fragment which should be replaced with actual values matching particular environment
  • AUTOMATE_CONFIG_REPO_PATH - Path to automate configuration repository (eg. /home/user/automate-config)
  • ENVIRONMENT_NAME - Environment name (eg. production)

Example

$ cd AUTOMATE_CONFIG_REPO_PATH/ENVIRONMENT_NAME/external-services

Should be substituted with:

$ cd /home/user/automate-config/production/external-services

Steps

1. Filling in configuration template

1.1 Navigate to Automate configuration repository.

$ cd AUTOMATE_CONFIG_REPO_PATH/ENVIRONMENT_NAME/external-services

1.2 RPM repository credentials

๐Ÿ“˜

SentiOne should provide credentials to RPM repository at https://hub.sentione.com

Please put these credentials in following section

AUTOMATE_CONFIG_REPO_PATH/ENVIRONMENT_NAME/external-services/inventory

[all:vars]
NEXUS3URL=https://hub.sentione.com
NEXUS3USER=PUT_YOUR_NEXUS_USERNAME_HERE
NEXUS3PASSWORD=PUT_YOUR_NEXUS_PASSWORD_HERE

1.2 Fill in following placeholders in following file

AUTOMATE_CONFIG_REPO_PATH/ENVIRONMENT_NAME/external-services/inventory:

[rabbitmq-master]
x.x.x.x ansible_user=root

[rabbitmq-slave]
x.x.x.x ansible_user=root
x.x.x.x ansible_user=root

[rabbitmq:children]
rabbitmq-master
rabbitmq-slave

[rabbitmq:vars]
RABBITMQ_USER=rabbit_user_name
RABBITMQ_PASSWORD=rabbit_password
....
RABBITMQ_1_IP=x.x.x.x
RABBITMQ_2_IP=x.x.x.x
RABBITMQ_3_IP=x.x.x.x

where:
-RABBITMQ_USER, RABBITMQ_PASSWORD variables refer to username and password that will be used to connect to the service

  • sections [rabbitmq-master], [rabbitmq-slave] should be filled in with IP addresses of nodes where RabbitMQ is supposed to be installed.
  • RABBITMQ_1_IP, RABBITMQ_2_IP, RABBITMQ_3_IP variables should be filled in with IP addresses of nodes where RabbitMQ is supposed to be installed (WARNING: [rabbitmq-master] section addresses must match RABBITMQ_1_IP)

2. SSH Connectivity check

In order to execute next steps you should make sure that you can connect to the nodes (set in configuration files) via SSH using key-based authentication as root user.

Example

user@localhost:~$ ssh [email protected]
Welcome to Ubuntu 20.04.1 LTS (GNU/Linux 5.4.0-47-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage
[email protected]:~#

3. Cloning GIT repository with Ansible scripts in $HOME directory

$ cd ~
$ git clone https://repo-ext.sentione.com/public/external-services.git
Cloning into 'external-services'...
Username for 'https://repo-ext.sentione.com': YOUR_GIT_USERNAME
Password for 'https://[email protected]@repo-ext.sentione.com':

4. Installation

Installation process is all about running two ansible playbooks.

  1. install-rabbitmq-playbook.yaml will install RabbitMQ service on three independent nodes.
  2. create-rabbitmq-cluster-playbook.yaml will form a cluster composed of three nodes created in first step.

4.1 Navigate to rabbitmq folder in external-services GIT repository

$ cd ~/external-services/rabbitmq

4.2 Run install-rabbitmq-playbook.yaml ansible playbook

$ ansible-playbook 
-i AUTOMATE_CONFIG_REPO_PATH/ENVIRONMENT_NAME/external-services/inventory \
install-rabbitmq-playbook.yaml

4.3 Run create-rabbitmq-cluster-playbook.yaml ansible playbook

$ ansible-playbook 
-i AUTOMATE_CONFIG_REPO_PATH/ENVIRONMENT_NAME/external-services/inventory \
create-rabbitmq-cluster-playbook.yaml

5. Test

In order to verify whether RabbitMQ was successfully installed you can either:

๐Ÿ“˜

To log in please use credentials defined in configuration files

RABBITMQ_USER, RABBITMQ_PASSWORD

  • Open administration panel in Web Browser of your choice:

    • http://RABBITMQ_1_IP:15672
    • http://RABBITMQ_2_IP:15672
    • http://RABBITMQ_3_IP:15672
  • Issue following curl command (in case Administration Panel is not available)

$ curl -u "RABBITMQ_USER:RABBITMQ_PASSWORD" http://RABBITMQ_1_IP:15672/api/vhosts
[{"cluster_state":{"[email protected]":"running"}, (...continued...)}]