Juju Charm - RabbitMQ
Go to file
Liam Young 3d5e1e22d8 Coordination module for rabbit restarts
Use the coordination module to manage restarting the rabbitmq
services. This is to ensure that restarts are only
performed on one unit at a time. This helps prevent
situation which can cause the cluster to become split
brained (eg if two or more nodes are restarted at the same
time).

* Manually run _run_atstart & _run_atexit method when actions
  are run as this does not happen automatically and is needed by
  the coordination layer.
* Replace restart_on_change decorator with
  coordinated_restart_on_change. coordinated_restart_on_change
  includes logic for requesting restart locks from the coordination
  module.
* The coordination module works via the leader and cluster events so
  the hooks now include calls to check_coordinated_functions
  which will run any function that is waiting for a lock.
* Logic has been added to check for the situation where a hook is
  being run via the run_deferred_hooks actions. If this is the
  case then restarts are immediate as the action should only be run
  on one unit at a time.

Change-Id: Ia133c90a610793d4da96d3400a3906b801b52b73
2022-02-17 11:06:00 +00:00
actions Coordination module for rabbit restarts 2022-02-17 11:06:00 +00:00
charmhelpers Charmhelper sync pulling coordinator 2022-02-07 09:42:38 +00:00
files Rabbitmq metrics and splitbrain detection 2022-01-17 18:32:38 +11:00
hooks Coordination module for rabbit restarts 2022-02-17 11:06:00 +00:00
lib Update tox.ini files from release-tools gold copy 2016-09-19 09:33:20 +01:00
templates Restrict TLS versions 2021-11-23 14:20:10 +00:00
tests Update to classic charms to build using charmcraft in CI 2022-02-15 17:06:59 +00:00
unit_tests Coordination module for rabbit restarts 2022-02-17 11:06:00 +00:00
.gitignore Update to classic charms to build using charmcraft in CI 2022-02-15 17:06:59 +00:00
.gitreview OpenDev Migration Patch 2019-04-19 19:44:42 +00:00
.stestr.conf Fix lint in unit tests re: py3-first and py2 compat 2018-11-01 21:57:56 -05:00
.zuul.yaml Use unittest.mock instead of mock 2021-12-15 11:54:45 +00:00
LICENSE Re-license charm as Apache-2.0 2016-07-01 18:06:36 +01:00
Makefile Port Charm RabbitMQ func tests from Amulet to Zaza 2019-10-10 13:05:09 +11:00
README.md Rabbitmq metrics and splitbrain detection 2022-01-17 18:32:38 +11:00
actions.yaml Implementation of deferred restarts 2021-04-09 21:11:30 +00:00
build-requirements.txt Update to classic charms to build using charmcraft in CI 2022-02-15 17:06:59 +00:00
charm-helpers-hooks.yaml Charmhelper sync pulling coordinator 2022-02-07 09:42:38 +00:00
charmcraft.yaml Add charmhelpers to charmcraft.yaml 2022-02-13 20:40:13 -07:00
config.yaml Switch to enabling the managment plugin by default 2021-11-29 11:06:18 +00:00
copyright Re-license charm as Apache-2.0 2016-07-01 18:06:36 +01:00
hardening.yaml Add hardening support 2016-03-24 11:38:33 +00:00
icon.svg Added icon.svg 2013-04-25 14:23:14 -04:00
metadata.yaml Migrate charm to charmhub latest/edge track 2022-01-29 10:25:46 -07:00
osci.yaml Update to classic charms to build using charmcraft in CI 2022-02-15 17:06:59 +00:00
pip.sh Add xena bundles 2021-09-27 20:08:29 +01:00
rename.sh Update to classic charms to build using charmcraft in CI 2022-02-15 17:06:59 +00:00
requirements.txt Sync release-tools 2021-07-22 15:00:48 +02:00
revision Added stats cronjob and queue monitoring nagios plugin 2014-05-07 10:52:24 +01:00
setup.cfg Add Python 3 Train unit tests 2019-07-30 10:20:48 -04:00
test-requirements.txt Use unittest.mock instead of mock 2021-12-15 11:54:45 +00:00
tox.ini Update to classic charms to build using charmcraft in CI 2022-02-15 17:06:59 +00:00

README.md

Overview

RabbitMQ is an implementation of AMQP, the emerging standard for high performance enterprise messaging. The RabbitMQ server is a robust and scalable implementation of an AMQP broker.

The rabbitmq-server charm deploys RabbitMQ server and provides AMQP services to those charms that support the rabbitmq interface. The current list of such charms can be obtained from the Charm Store (the charms officially supported by the OpenStack Charms project are published by 'openstack-charmers').

Usage

Configuration

This section covers common and/or important configuration options. See file config.yaml for the full list of options, along with their descriptions and default values. See the Juju documentation for details on configuring applications.

min-cluster-size

The min-cluster-size option sets the number of rabbitmq-server units required to form its cluster. It is best practice to use this option as doing so ensures that the charm will wait until the cluster is up before accepting relations from other client applications.

source

The source option sets an alternate software source and can be passed during or after deployment. The default behaviour is to use the Ubuntu package archive for the underlying machine series. The most common value is a UCA cloud pocket (e.g. 'cloud:bionic-train'). In the case of a non-OpenStack project, there is no guarantee that a candidate will be found in the stated UCA pocket.

Note: Changing the value of this option post-deployment will trigger a software upgrade. See OpenStack upgrade in the OpenStack Charms Deployment Guide.

Deployment

To deploy a single rabbitmq-server unit:

juju deploy rabbitmq-server

To make use of AMQP services, simply add a relation between rabbitmq-server and an application that supports the rabbitmq interface. For instance:

juju add-relation rabbitmq-server:amqp nova-cloud-controller:amqp

Monitoring

To collect RabbitMQ metrics, add a relation between rabbitmq-server and an application that supports the scrape interface. For instance:

juju add-relation rabbitmq-server:scrape prometheus:scrape

Note: The scrape relation is only supported when the RabbitMQ version is >= 3.8.

The charm can be related to a dashboard charm like grafana to view visualization metrics:

juju add-relation rabbitmq-server:dashboards grafana:dashboards

To get alerts of RabbitMQ split-brain events, add a relation between rabbitmq-server and an application that supports the prometheus-rules interface. For instance:

juju add-relation rabbitmq-server:prometheus-rules prometheus:prometheus-rules

High availability

When more than one unit is deployed the charm will bring up a native RabbitMQ HA active/active cluster. The min-cluster-size option should be used (see description above).

See Infrastructure high availability in the OpenStack Charms Deployment Guide for details.

TLS

Communication between the AMQP message queue and client services (OpenStack applications) can be TLS-encrypted. There are two methods for managing keys and certificates:

  1. with Vault
  2. manually (via charm options)

Vault can set up private keys and server certificates for an application. It also stores a central CA certificate for the cloud. See the vault charm for more information.

Vault is the recommended method and is what will be covered here.

The private key and server certificate (and its signing) are managed via a relation made to the vault application:

juju add-relation rabbitmq-server:certificates vault:certificates

Actions

This section lists Juju actions supported by the charm. Actions allow specific operations to be performed on a per-unit basis.

  • check-queues
  • cluster-status
  • complete-cluster-series-upgrade
  • list-unconsumed-queues
  • pause
  • resume

To display action descriptions run juju actions --schema rabbitmq-server. If the charm is not deployed then see file actions.yaml.

Documentation

The OpenStack Charms project maintains two documentation guides:

Bugs

For general charm questions refer to the OpenStack Charm Guide.