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:
[buildout]
parts =
backup
repozo
[backup]
recipe = collective.recipe.backup
[repozo] recipe = zc.recipe.egg eggs = ZODB3 scripts = repozo
2.Run the command
bin/buildout -N
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.
Regular Database Backup/Restore
Now that we’ve covered the installation, all you need is from command line run one of the following commands:
bin/backup
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.
bin/zeopack
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
Database Restore
Restoring your database is more complex then backing it up. Upon running the following commands you’ll be asked to confirm the restore procedure:
bin/restore
restores the latest backup and the blobstorage if you have that.
bin/restore yyyy-mm-dd[-hh[-mm[-ss]]]
restores the database as of a specific date.
Snapshot Backup/Restore
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:
bin/snapshotbackup
It places a full backup of your database at that specific point of time in var/snapshotbackups directory.
bin/snapshotrestore
Just a few simple commands and you can back up and secure your data.
Blob Storage Backup/Restore
With collective.recipe.backup your blob storage is backed up by default and restored upon calling database restore command.