dockerrabbitmqcontainersmessagingdocker-volume

How can I change the rabbitmq persist message location on Windows?


For our system we mark important messages with the delivery mode = 2, and are sending them on durable exchanges and queue's. The problem is that rabbitmq is being hosted on a docker container, and if that container goes down, the messages that have been persisted are lost upon container restart.

I want to know if there is a way to change the location of the persistence of messages to a mounted volume instead of the container-backed disk, and if so how. I also currently cant figure out where the messages are actually being persisted right now, and so finding to config for that is definitely a start, I'm just not sure where this is set as I cant find anything related to mnesia, and that seems to be a default for some people. This change to location could be at runtime or not, it is unimportant to me.

Also for help, try to keep in mind that all of this is very new to me so I'm not the most educated on how this system functions in all of its glory, so simple explanations will help a good deal more than those with unnecessarily complex solutions. Let me know if I can provide any other helpful info.


Solution

  • It's right here in the RabbitMQ documentation.

    Create the /etc/rabbitmq/rabbitmq-env.conf file with the following contents to change the persistent data location:

    MNESIA_DIR=/path/to/mounted/volume
    

    Note that the RABBITMQ_ prefix is not necessary for variables defined in rabbitmq-env.conf