[rabbitmq-discuss] How does Messages will be persisted in RabbitMQ?

Tim Watson tim at rabbitmq.com
Fri Aug 30 13:11:43 BST 2013


What Michael said, plus just to clarify...

On 30 Aug 2013, at 12:49, Michael Klishin wrote:
>> So, you mean we shouldn't use any database where RabbitMQ does for us ,
>> 

Not only shouldn't you, you *cannot* use an alternative database for the purpose of storing persistent messages.

A vanilla RabbitMQ install (with no plugins in use) uses three different kinds of databases, two of which are persisted to disk:

1. mnesia - used to store "schema" data, such as queue, exchange and binding definitions (as per Michael's earlier explanation), either to disk or in ram
2. the message store - used to store persistent messages to disk (and messages that require paging due to memory pressure)
3. the message store index - stores the position of messages in queues, in memory by default (but can use alternative mechanisms such as tokyo cabinet)

>>    2> even it doesn't use even any file system. 
>> 

It *does* use the file system. The internal database writes data to a number of files which are (incidentally) stored underneath the root mnesia directory, although they have nothing to do with mnesia (we just store them in the same directory). These files contain data encoded in an internal format which is not human readable and we do not provide any tools for inspecting the contents of these database files.

>> In this case how can we restore the database in case of server crash or some other issue.
> 
> RabbitMQ will recover durable queues/exchanges and persistent messages in those queues
> on start. It will also perform database upgrades when you install a newer version.
> 

Specifically, RabbitMQ will use the aforementioned files when recovering persistent messages stored in durable queues on startup.

Tim


More information about the rabbitmq-discuss mailing list