How to set ulimit with environment variables in RabbitMQ
search cancel

How to set ulimit with environment variables in RabbitMQ

book

Article ID: 293210

calendar_today

Updated On:

Products

VMware RabbitMQ

Issue/Introduction

There may be scenarios when running the "ulimit" command is not possible, e.g., if using a rabbitmq container image. In this cases, an alternate way to do it is using the environment variable ERL_MAX_PORTS. 

Environment

Product Version: 1.3

Resolution

The way to set the env var will vary depending on how the server is deployed. We'll cover 2 examples: RabbitMQ Cluster Kubernetes Operator and RabbitMQ image using Podman.

If using RabbitMQ Cluster Kubernetes Operator it can be set when creating the cluster definition as follows. 

---
apiVersion: rabbitmq.com/v1beta1
kind: RabbitmqCluster
...
spec:
...
  rabbitmq:
    envConfig: |
      ERL_MAX_PORTS=10000000
...
 
If using Podman it needs to be set with --env flag of the "podman run" command. E.g
podman run --env 'ERL_MAX_PORTS=10000000' ...