Disasters can't be predicted, but they can be prepared for. In this episode you export and import RabbitMQ definitions, devise message backup strategies, plan RPO and RTO, leverage Federation and Shovel for disaster recovery, and migrate between clusters without downtime.

In episode 30, RabbitMQ topology became code stored in Git. That makes definitions easy to restore — but what about the messages in the queues? Lost definitions can be recreated, but acknowledged messages that were never processed, once lost, may never be replaced. This is the core of RabbitMQ backup.
It's important to understand from the start: RabbitMQ doesn't provide a file snapshot you can just copy, because data is spread across internal file segments. The correct backup strategy focuses on two things: topology definitions (small and easy) and messages (which need a special approach).
This episode covers definition backup and restore, message options, RPO and RTO planning for disaster recovery, using Federation and Shovel as a DR strategy, and zero-downtime migration between clusters.
Definitions cover vhosts, users, permissions, policies, queues, exchanges, and bindings — everything needed to rebuild the topology. Export via the Management API:
curl -u arman:pass http://localhost:15672/api/definitions \
-o rabbit-definitions.jsonInclude the definition backup in an automatic schedule, for example a daily cron. Store it in a location separate from the broker — if the node is lost, the backup file must stay safe.
Schedule periodic definition exports with a simple script:
0 2 * * * curl -u arman:pass \
http://localhost:15672/api/definitions \
-o /backup/rabbit-$(date +\%F).jsonAdd rotation so old files don't pile up, for example keeping only the last 30 days. Versioning backup files in object storage gives clear recovery dates: when the definitions were last exported, and under what topology state.
RabbitMQ has no message snapshot mechanism. Common options:
An honest design decision: often messages in queues are considered transient and allowed to be lost, while real business data is stored in another database. Establish this policy explicitly.
To recover the topology, import the exported definitions:
rabbitmqctl import_definitions /path/rabbit-definitions.jsonThe import_definitions command recreates vhosts, queues, exchanges, users, and policies. Remember: importing definitions does not restore lost messages — only the structure.
Definitions exported from an old version can be imported into a newer version, but not the other way around. When restoring to a newer broker, verify queue arguments and policies that are no longer supported. Always test the restore procedure in a staging environment before depending on it.
RPO (Recovery Point Objective) is how much data may be lost; RTO (Recovery Time Objective) is how fast the service must recover. Example: an RPO of 15 minutes means backup or replication may only lag 15 minutes; an RTO of 1 hour means the team must recover within 1 hour.
Multi-region design: deploy a broker in two regions, replicate topology with Federation, and switch application connections to the standby region when the primary fails. Test failover periodically — a DR that's never tested is just a hope.
Federation provides topology and message replication between clusters — good for a small RPO. Shovel can selectively copy messages to queues in the standby region. Their combination forms a continuously running DR pipeline, so when disaster strikes, the standby region already has the latest data.
Migration between clusters (for example, moving versions or regions) uses the same pattern as episode 20: build the new cluster, connect with a Shovel to copy messages, switch consumers gradually, then shut down the old one.
shovels.migrate = [
{source, [{uris, ["amqp://old-cluster"]}, {queue, "orders.q"}]},
{destination, [{uris, ["amqp://new-cluster"]}, {queue, "orders.q"}]}
]For migrations demanding full accuracy, combine the shovel with replay: consumers on the old cluster read messages and re-publish them to the new cluster after verification. Replay gives more control (it can be validated) than a blind shovel, at the cost of latency.
Warning
Test the restore procedure at least once fully before production. The best time to find definitions that can't be imported is during a drill, not during an incident.
In episode 31 you exported and imported definitions, devised message backup strategies, planned RPO and RTO, leveraged Federation and Shovel for disaster recovery, and migrated between clusters without downtime.
Key takeaways:
In the next and final episode, we will sum up the entire journey with the production deployment checklist — capacity planning, security hardening, monitoring, upgrade procedures, performance baselines, pitfalls to avoid, and the list of modern 3.11 to 3.13 features you should take advantage of. This is the graduation gate toward production RabbitMQ!