Important

You are browsing documentation for version 5.1 of OroCommerce, supported until March 2026. Read the documentation for version 6.0 (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 how to back up and restore the message queue when working with Oro applications. For more information on how to back up and restore RabbitMQ, see the related documentation on RabbitMQ website.

Backup 

RabbitMQ backups are JSON representation of your broker’s metadata which includes users, vhosts, queues, exchanges, and bindings.

Backup Procedure 

  1. Stop all consumers

  2. Export definitions

  3. Back up messages

  4. 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. Messages’ data is stored in the node's data directory. Here, the nodes are collected in the msg_stores/vhosts subdirectory which has other directories created 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 

For messages to be restored, the broker should have all the definitions already in place. Message data for unknown vhosts and queues will not be loaded and can be deleted by the node.

Restore Procedure 

  1. Stop all consumers

  2. Enable maintenance mode

  3. Import definitions

  4. Restore messages

  5. Exclude messages

  6. Stop maintenance mode

  7. 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: