cytsunny
cytsunny

Reputation: 5030

Is there a way to rescue the queue after RabbitMQ crashed?

RabbitMQ crashed when some test were done. For statistical reason, the number of packet remaining in the queue when crashed is needed. Under /var/lib/rabbitmq/mnesia/rabbit@VM_16_11_centos/queues/5PHK4O2BWQQNR6JA7K2PX8355, I found that there are a bunch of .idx files and an empty journal.jif (there is only one queue running at that time, so this folder is the only option)

Is there a way to rescue the queue with these files?

P.S. to prevent deleting other files, the RabbitMQ is left down to prevent erasing other necessary binary files.

Upvotes: 0

Views: 2117

Answers (1)

Mannan Sajid
Mannan Sajid

Reputation: 13

I found this tool that can read the RabbitMQ IDX files and persistent store RDQ files. I was able to then re-import that data back into RabbitMQ one message at a time and let my consumers process the data normally.

https://github.com/jeffbryner/rdqdump

For Future precautionary measure :

The queue/exchange can be marked as Durable so that it will be recreated and survives any kind of server failure, crash or broker restart. (Durable entities can survive server restarts, by being automatically recreated once the server gets back up.)

Marking the queue Durable does not imply that the messages in the queue will also get recreated.

For that to happen the messages can be marked as Persistent. (Persistent messages will be written to disk as soon as they reach the queue and will only be marked for garbage collection once they are consumed (and acknowledged) from a durable queue.)

Upvotes: 1

Related Questions