Important
You are browsing upcoming documentation for version 7.1 of OroCommerce, scheduled for release in 2027. Read the documentation for the latest LTS version to get up-to-date information.
See our Release Process documentation for more information on the currently supported and upcoming releases.
Backup and Restore
This section provides recommendations on backing up and restoring the message queue in Oro applications. For more details, see the related documentation on RabbitMQ website.
Backup
A RabbitMQ backup is a JSON representation of your broker’s metadata: users, vhosts, queues, exchanges, and bindings.
Backup Procedure
Stop all consumers
Export definitions
Back up messages
Start all consumers
Note
Maintenance mode is not required for creating RabbitMQ backup.
Exporting Definitions
Use the export command provided by the RabbitMQ management plugin to back up definitions.
rabbitmqadmin export /path/to/your/backup/directory/definitions.backup
Backing Up Messages
Stop all consumers to back up messages. Message data is stored in the node's data directory, under the msg_stores/vhosts subdirectory, which holds a directory per vhost.
The only way to back up messages is to copy ``msg_stores`` messages data directory.
# check your node directory
rabbitmqctl eval 'rabbit_mnesia:dir().'
# copy messages
cp -a /var/lib/rabbitmq/mnesia/your\@node/msg_stores/ /path/to/your/backup/directory/msg_stores
Restore
Before restoring messages, the broker must already have all the definitions in place. The node does not load message data for unknown vhosts and queues, and it may delete such data.
Restore Procedure
Stop all consumers
Enable maintenance mode
Import definitions
Restore messages
Exclude messages
Stop maintenance mode
Start all consumers
Import Definitions
Use the import command provided by the RabbitMQ management plugin to restore definitions.
rabbitmqadmin import /path/to/your/backup/directory/definitions.backup
Restore Messages
Copy msg_stores messages data directory to the node's data directory.
# stop RabbitMQ node
rabbitmqctl stop_app
# copy messages
cp -a /path/to/your/backup/directory/msg_stores/* /var/lib/rabbitmq/mnesia/your\@node/msg_stores/
# start RabbitMQ node
rabbitmqctl start_app
Note
If your backup node name is different, you can change it as described in the documentation on RabbitMQ website.
Exclude Messages (emails notifications, 3rd party application updates, etc.)
To prevent reprocessing messages that contain email notifications, 3rd party application update, etc., filter them by routing key and divide a single queue into separate queues, as described in the Divide Single Queue to Separate Queues topic. After that, you can easily remove separate queues with excluded messages.
For more information, see the following external resources: