2

I'm using Rabbitmq docker images with version: rabbitmq:3-management.

docker run -d --hostname my-rabbit --name ecomm-rabbit -p 15672:15672 -p 5672:5672 rabbitmq:3-management

And I'm curious about the way it stores msg in the queue (in case of persistent data in disk instead of RAM).

I've read this post and the accepted answer said that:

RabbitMQ uses a custom DB to store the messages, the DB is usually located here:

/var/lib/rabbitmq/mnesia/rabbit@hostname/queues

However, when I navigate to this folder, I didn't see that.

My question is: What is the folder/file it storing the DB file? And what does kind of or structure look like?

Nguyễn Văn Phong
  • 13,506
  • 17
  • 39
  • 56

1 Answers1

1

To answer the first question, check section RABBITMQ_MNESIA_DIR here. Here are the default values unless RABBITMQ_MNESIA_DIR is set explicitly.

  • Generic UNIX package: $RABBITMQ_HOME/var/lib/rabbitmq/mnesia
  • Ubuntu and Debian packages: /var/lib/rabbitmq/mnesia/
  • RPM: /var/lib/rabbitmq/plugins
  • MacOS (Homebrew): ${install_prefix}/var/lib/rabbitmq/mnesia, the Homebrew prefix is usually /usr/local
  • Windows: %APPDATA%\RabbitMQ

You will see some .dcd and .dcl files. Meaning we have a mnesia database. To verify that,

> erl -mnesia dir '"/var/lib/rabbitmq/mnesia/rabbit@YOUR_CONTAINER_ID"'
1> mnesia:start().
ok
2> mnesia:system_info().
# here you will see tables like `rabbit_durable_exchange`
lastr2d2
  • 3,604
  • 2
  • 22
  • 37