rabbitmq_cluster: limit queue size to 1GB and remove stale queues

When a user creates a queue and then never consumes from it (such at the
current Greenwave queue) it grows and grows forever. This isn't a
problem in the short term as messages are very small and 100K messages
is in the range of 10MB (depending on the payload size, obviously), but
eventually it will lead to trouble.

This policy will delete any queue that has had no subscribers in 31
days, and as a safety measure also limits all queues to 1GB of storage,
which is probably excessive.

Signed-off-by: Jeremy Cline <jeremy@jcline.org>
This commit is contained in:
Jeremy Cline 2019-06-19 14:06:50 +00:00
parent edac7114e8
commit 78128ae0ff

View file

@ -180,6 +180,24 @@
- rabbitmq_cluster
- config
- name: Add a policy to limit queues to 1GB and remove after a month of no use
run_once: true
delegate_to: "rabbitmq01{{ env_suffix }}.phx2.fedoraproject.org"
rabbitmq_policy:
apply_to: queues
name: pubsub_sweeper
state: present
pattern: ".*"
tags:
# Unused queues are killed after 1000 * 60 * 60 * 31 milliseconds (~a month)
expires: 111600000
# Queues can use at most 1GB of storage
max-length-bytes: 1073741824
vhost: /pubsub
tags:
- rabbitmq_cluster
- config
- name: Create the admin user for the pubsub vhost
rabbitmq_user:
user: admin