RabbitMQ Summary

Summary of what I needed from the RabbitMQ docs

RabbitMQ Summary_Still on

Goal

Learn how to install RabiitMQ as a cluster and its features.

About RabbitMQ

It’s an open source Message Queue system.

Features

Terms

Install

Where To Install

Requirements

Dependencies

Ways To Install

Use Cloudsmith Mirror Yum Repository

  1. Install RabbitMQ and Cloudsmith Signing Keys
  2. Add Yum REpositories for RabbitMQ and Modern Erlang
  3. Install Packages with dnf(yum)
  4. Install Packages with Zypper
  5. (Optional but Recommended) Package Version Locking in On RPM-based Distributions

Use rpm

# import the signing key for repositories
## primary RabbitMQ signing key
rpm --import 'https://github.com/rabbitmq/signing-keys/releases/download/3.0/rabbitmq-release-signing-key.asc'
## modern Erlang repository
rpm --import 'https://github.com/rabbitmq/signing-keys/releases/download/3.0/cloudsmith.rabbitmq-erlang.E495BB49CC4BBE5B.key'
## RabbitMQ server repository
rpm --import 'https://github.com/rabbitmq/signing-keys/releases/download/3.0/cloudsmith.rabbitmq-server.9F4587F226208342.key'

# Add Yum Repositories for RabbitMQ and Modern Erlang
## Follow "Red Hat 9, CentOS Stream 9, Rocky Linux 9, Alma Linux 9, Modern Fedora Releases" from https://www.rabbitmq.com/install-rpm.html
sudo vi /etc/yum.repos.d/rabbitmq.repo
sudo dnf update -y
sudo dnf install -y socat logrotate
sudo dnf install -y erlang rabbitmq-server

Direct Downloads

You can check Github (2024.1.25) I’m gonna skip for now

Run RabbitMQ

To run the server by daemon,

sudo systemctl enable rabbitmq-server

Configuring RabbitMQ

You can check most of configs by rabbitmq-diagnostics status`

By default, the config file would not have beens set, so check this

Managing the Service

Log Files and Management

Setting A Cluster Up

There are many ways to form a cluster, such as config file, DNS-based discovery, AWS and even a manual way using rabbitmqctl.

How RabbitMQ NOdes Are Identified

Each nodes will be identified by their node names, a combination of a prefix(usually rabbit) and hostname, concatenated through @, which must be unique in a cluster. Hostname can be resolved using any of standard OS-provided methods: such as DNS records, Local host files(/etc/hosts)

Requirements For Clustering

Ports Access

You can change the ports using configuring.

Data which Replicated Between Cluster Nodes

What Cluster Means For Clients

Peer Discovery

To form a cluster, each nodes need to be able to discover the others. There are two options for this. Introducing every nodes ahead of the time(using config file) or dynamic(nodes can com and go)

Use cluster_formation.peer_discovery_backend in the config file to set which Peer Discovery way you’d like to use. And also you can specify other clustering settings such as discovery service hostnames, credentials, and so on.

How It Works

  1. Node starts
  2. If peer discovery is set, detects whether there is a previously initialized database.
  3. Perform the discovery(It may involve contacting external services, such as Consul for the AWS plugin)
  4. Attempt to contact others in order
  5. Attempt to join the cluster of the first reachable peer

Config File

(2024.1.25) I’ll skip this for now.

Pre-configured DNS A/AAAA records

Via Plugins

You don’t need to install these plugins but enable them. Follow this cli.

rabbitmq-plugins --offline enable <plugin name>

like

rabbitmq-plugins --offline enable rabbitmq_peer_discovery_k8s

(2024.1.25) But I’ll skip this for now.

Network Partition

I need to check this information. It seems quite complicated.

Use Odd Numbers Of Nodes

Restarting Node

Node Readiness Probes

Removing A Cluster Node

Reset A Cluster Node to a blank state

References