Configure RabbitMQ

Reduce startup time

Before startup, each RabbitMQ pod executes a sleep command to prevent negative DNS caching results which can cause problems with inter node communication for stream queues during restarts of RabbitMQ.

If you are working in a productive environment, this should only be done if the the DNS cache TTL of the Kubernetes DNS server is changed first. Afterwards, the sleep duration can be overwritten by setting messageQueue.dnsCacheTTL inside the OpenStack manifest accordingly.

Inside development clusters it is fine to set the value 0 without adjusting the DNS server, just expect to encounter some error messages concerning stream queues.

Set requests and limits for RabbitMQ

You can set CPU and Memory requests and limits for the AMQPServers like for every other Kubernetes workload.

Note

The requests and limits are used to set some RabbitMQ config options: total_memory_available_override_value and default_worker_pool_size

The config option total_memory_available_override_value is calculated by using the Memory limits minus some headroom.

The option default_worker_pool_size is set based on CPU requests and only if there are no requests, the CPU limits are used instead. The request(or limit) is rounded down to a full CPU and used as worker count, minimum is one worker. This is because it’s not recommended to use CPU limits, but if you do, the MQ config should still respect that.

Important

This means, that the erlang Process of RabbitMQ will only use as much cores as defined in the CPU requests, also you have a much higher limit set.

Still the container may use more CPU, as there are other processes that also need some resources.

Override images

If you want to use custom images for an AMQPServer, do so by adding a dictionary to .spec.imageOverrides with the pinned versions as keys and the image overrides as values. For upgrades, you have to include every supported minor version from your current version up to the target version. These overrides take precedence over the infra operator’s YAOOK_OP_VERSIONS_OVERRIDE. Use at your own risk.

apiVersion: infra.yaook.cloud/v1
kind: AMQPServer
name: "sample-amqp"
spec:
    imageOverrides:
        library/rabbitmq:3.13: custom-url/rabbitmq:v3.13
        library/rabbitmq:4.1: custom-url/rabbitmq:v4.1
        library/rabbitmq:4.2: custom-url/rabbitmq:v4.2
    ...

Using .spec.imageRef to override images is out of support and the setting will be removed in the future.

If the AMQPServer was not created by another operator, you can migrate from imageRef to targetRelease by adding the imageOverrides without removing .spec.imageRef and waiting until the infra operator reconciled the AMQPServer. To upgrade it, remove .spec.imageRef and specify the targetRelease afterwards. Currently, 4.2 is the latest supported release.

Disable quorum queue limits

Warning

Disabling the limit is discouraged.

By default, Yaook will limit the size of each quorum queue to 5% of the total available disk space. This ensures that other queues are still usable in case of a broken consumer or a misconfiguration. Disabling the limit increases the timespan until issues occur, but the AMQPServer will become entirely unusable once the limit of the PVC is reached.

To disable the limit, add the following configuration:

apiVersion: infra.yaook.cloud/v1
kind: AMQPServer
name: "sample-amqp"
spec:
    enableQueueSizeLimit: false
    ...

RabbitMQ exporter configuration

The RabbitMQ exporter configuration can be modified inside .spec.messageQueue.exporterConfig of the OpenStack k8s manifest, or if you are using a standalone AMQPServer, inside .spec.exporterConfig.

Configuration value

Type

Description

logLevel="INFO"

string

Supported values: “DEBUG”, “INFO”, “WARN”, “ERROR”

accumulatingMessagesThreshold=50

int

Threshold for the number of messages inside a queue used by the metric rabbitmq_quorum_queue_accumulating_messages_count

accumulatingMessagesCriticalThreshold=500

int

Threshold for the number of messages inside a queue used by the metric rabbitmq_quorum_queue_accumulating_messages_critical_count

scrapeInterval=60

int

Scraping interval in seconds. See the RabbitMQ documentation for more information

httpTimeout=10

int

Timeout in seconds for requests to the RabbitMQ management API