Backup/restore of Plone database via buildout
These instructions will help you back up your Plone database data.fs as well as blob storage. Data.fs is ZODB filestorage for transactional database. Plone 4 uses a blob storage to store files (Binary Large OBjects) such as images or office documents on the file system.
These instructions apply to Plone 4.x.
Tutorial consists of the following sections:
- Regular Database Backup/Restore
- Database Restore
- Snapshot Backup/Restore
- Blob Storage Backup/Restore
First thing you need to do is install Collective.recipe.backup.
This particular product will make backup/restore procedure so much easier. To install it:
1. Add the recipe to your buildout.cfg:
recipe = collective.recipe.backup
[repozo] recipe = zc.recipe.egg eggs = ZODB3 scripts = repozo
2.Run the command
It will add a backup, snapshotbackup, restore and snapshotrestore script to the bin/ directory of the buildout and, by default, it creates the var/backups and var/snapshotbackups directories in that same buildout.
Now that we’ve covered the installation, all you need is from command line run one of the following commands:
makes an incremental backup that creates a backup of the Data.fs in var/backups. The blob storage is by default backed up to var/blobstoragebackups.
removes unused objects from your ZODB. You should do it regularly, once a week. The next time bin/backup is called, a complete fresh backup is made
Restoring your database is more complex then backing it up. Upon running the following commands you’ll be asked to confirm the restore procedure:
restores the latest backup and the blobstorage if you have that.
restores the database as of a specific date.
It is a good practice to do snapshots of your database, especially for testing purposes and keeping the system up during major maintenance. A snapshot is basically a copy of your file system at that specific point in time. To backup or restore your latest database snapshot call:
It places a full backup of your database at that specific point of time in var/snapshotbackups directory.
Just a few simple commands and you can back up and secure your data.
With collective.recipe.backup your blob storage is backed up by default and restored upon calling database restore command.