Skip to main content

Backup strategy

This guide outlines the procedures for backing up and restoring your Mambo installation data. Regular backups help prevent data loss and ensure business continuity.

Prerequisites

  • Access to command line tools
  • MongoDB client tools installed
  • Administrative access to your Mambo installation
  • Access to AWS tools (if using S3 storage)

Data backup

MongoDB backup

To backup MongoDB, use the mongodump command to produce a dump in BSON format:

Bash

The dump can then be copied to a safe location.

Alternatively, the MongoDB data folder could be backed up directly using low-level utilities (e.g. cp, rsync or cloud storage snapshots). In this case, it's important to lock the database before performing the backup. For further information, please refer to the MongoDB backup documentation.

Image store backup

Mambo offers three possible backends for storing images, which are configured with the storage.type option in the mambo.properties configuration file:

  1. MongoDB storage: If the storage uses MongoDB, there's nothing to backup explicitly as the images would already be included as part of the MongoDB backup.

  2. AWS S3 storage: If the images are stored in AWS S3, they can be backed up with AWS Backup.

  3. Local filesystem storage: If the images are stored in a folder in the local filesystem, this folder can be copied to a backup location using standard system utilities such as rsync:

Bash

The location of the local image store is configured with the storage.upload.dir option in the mambo.properties configuration file.

Restoring from a backup

warning

Before starting a restoration from backup, you must stop all Tomcat instances.

Restoring the database

Before restoring MongoDB, you must drop the existing database:

Bash

Then you can restore MongoDB from the dump:

Bash

Restoring images

If the image store is configured to use local filesystem storage, it can be restored by copying the images from the backup to the storage.upload.dir folder configured in the mambo.properties file:

Bash

If the image store is configured as AWS S3, you can follow the AWS Backup documentation to restore data.

Alternatively, if the image store uses MongoDB storage, there is no need to explicitly restore the data as it would have already been restored by the mongorestore command.

Once the restoration is complete, you can restart all Tomcat instances.

Troubleshooting

  • If you encounter permission errors during the backup or restore process, ensure you have the necessary administrative privileges.
  • If MongoDB fails to restore, check that all Tomcat instances are stopped and that no other processes are accessing the database.
  • For AWS S3 backup issues, verify your AWS credentials and permissions.

Summary

  • Always backup both MongoDB data and images (if not stored in MongoDB)
  • Stop all Tomcat instances before beginning the restoration process
  • Restart Tomcat only after the entire restoration is complete
  • Test your backup and restoration procedures regularly to ensure they work correctly