Add a RabbitMQ vhost for pubsub (fedmsg) and configure an HA policy

Since many of our applications will likely wish to use RabbitMQ for
private things like work queues, using separate vhosts is a good idea.
This sets up a single vhost to act as a fedmsg replacement (called
pubsub) and configures it for high availability.

The HA policy mirrors queues to all nodes in the cluster and enables
automatic synchronization with a batch size of 10K messages. Automatic
synchronization means that when a new node joins the cluster, all
messages from existing nodes are pushed to the new node, blocking queue
activity until mirroring is complete.

Signed-off-by: Jeremy Cline <jcline@redhat.com>
This commit is contained in:
Jeremy Cline 2018-09-28 11:07:40 -04:00 committed by Jeremy Cline
parent 49355e6d83
commit f57f3026d5
2 changed files with 29 additions and 10 deletions

View file

@ -1 +0,0 @@
[rabbitmq_management,rabbitmq_auth_mechanism_ssl].

View file

@ -52,15 +52,6 @@
- rabbitmq_cluster
- config
- name: enable plugins
copy: src=enabled_plugins dest=/etc/rabbitmq/enabled_plugins owner=root group=root mode=0644
with_items:
- rabbitmq.config
- enabled_plugins
tags:
- rabbitmq_cluster
- config
- name: deploy configuration
template: src={{item}} dest=/etc/rabbitmq/{{item}} owner=root group=root mode=0644
with_items:
@ -96,6 +87,13 @@
- rabbitmq_cluster
- config
- name: Enable the HTTP management console and SSL authentication plugins
rabbitmq_plugin:
names: rabbitmq_management,rabbitmq_auth_mechanism_ssl
tags:
- rabbitmq_cluster
- config
- name: start rabbitmq
service: name=rabbitmq-server state=started enabled=yes
tags:
@ -106,3 +104,25 @@
tags:
- rabbitmq_cluster
- config
- name: Configure the pubsub virtual host
rabbitmq_vhost:
name: /pubsub
state: present
tags:
- rabbitmq_cluster
- config
- name: Configure the HA policy for queues on the pubsub virtual
rabbitmq_policy:
name: HA
apply_to: queues
pattern: .*
tags:
ha-mode: all
ha-sync-mode: automatic # Auto sync queues to new cluster members
ha-sync-batch-size: 10000 # Larger is faster, but must finish in 1 net_ticktime
vhost: /pubsub
tags:
- rabbitmq_cluster
- config