[rabbitmq-discuss] is there a good way to upgrade my broker without losing messages?

Matthias Radestock matthias at lshift.net
Mon Aug 3 21:37:14 BST 2009


Ryan Davis wrote:
> I'm currently running an older version of RabbitMQ (1.5.1) on windows,
> using a single broker for my lightly-loaded system.  All
> publishers/consumers are pointed to that broker.  I want to upgrade to
> 1.6, but don't want to lose any messages.  I cannot turn off all
> publishers (messages come from external sources).   I've read that the
> db schema changes, and the old db essentially gets replaced.  This means
> even durable messages will get discarded, right?

Yes, persistent messages would indeed get discarded.

However, the format of the message store (as opposed to the routing 
tables, etc) didn't actually change between 1.5.x and 1.6.0, so in 
theory it should be possible to do the following:

1) stop old rabbit version
2) move the rabbit_persister.LOG to a safe place
3) start new rabbit version
4) use some client code to re-create all the durable queues and exchanges
5) stop the new rabbit version
6) replace the fresh rabbit_persister.LOG with the old one
7) restart the new rabbit version

At that point the persisted messages should be available in their 
respective durable queues again, so your clients can connect and consume 

> I've come up with a few ideas involving putting up another RabbitMQ
> instance (point publishers at the new broker, let my consumers empty the
> old broker, point consumers at the new broker), but I was wondering: is
> there easier way to do it?

Arguably your suggestion is simpler than the above :) Plus it will work 
even when the message store format *has* changed. I know which one I'd 
choose ;)



More information about the rabbitmq-discuss mailing list