Backup
Magnolia Backup module ensures the proper backup of data from inside of Magnolia. This module is an alternative to file system and database backup solutions. The module features immediate interactive backup of JackRabbit backed repositories and scheduled recurring backup support with cron like configuration options.
- Download
- Installing
- Uninstalling
- Taking a backup
- Scheduling a backup
- Restoring a backup
- Deleting search indexes
- Database size
- Changing persistence managers
Download
Download the Backup module from Magnolia Store or Nexus repository
Installing
Backup is an enterprise module (3.6 and higher) included in the Enterprise Edition bundle and typically already installed. Go to Magnolia Store > Installed modules in AdminCentral to check. To install the module individually, see the general module installation instructions. Additionally, backup and restore scripts are found in the bin directory.
Uninstalling
See the general module uninstalling instructions and advice.
Taking a backup
Go to Tools > Backup, enter the target path for backup and click on the Backup button. The target path will be created if it doesn't exist.
The backup consists of the following files:
repoConfig.zip- all configuration files necessary to restore the repositories.history.gz- versions of all versionable content from all repositories.<workspace_name>.gz- one file per workspace. Holds all the content of given workspace.blobs- folder with binary data from all the workspaces.
Backup files contain confidential information on how to connect to the database. You should therefore keep your backup files at secure location.
Scheduling a backup
To configure scheduled backup go to Configuration > /modules/backup/config/ and create a new entry. See the preconfigured weekly backup task as a reference. Setting backup time and recurrence is done using cron-like date/time selection pattern for the scheduler.
Restoring a backup
The restore script is meant to recreate an instance, not to patch an existing one. For it to work correctly you should clean your database schema before running it. To restore the previously backed up data, use the restore script from the backup module bundle.
There is no UI for running the restore script. You need to run the script before starting Magnolia CMS so that the script can re-create the repository.
To make sure the webapp directory is properly setup before running the restore, we recommend you take the WAR file or webapp from the bundle, add all your custom modules, startup the server once and perform the installation. After that, shutdown the server, delete the repositories directory and run the restore as specified below.
restore [options]
Options:
-backup <dir>. Backup folder.-help-lib <dir>. Directory containing Magnolia's jar files. If not specific, the webapp's directory is suffixed withWEB-INF/lib/.-propertyfiles <arg>. List of properties files to load. If not specified, the value inweb.xmlis used, and Magnolia's default is used if it is not specified inweb.xmleither.-saveAfter <num>. Persistence counter. The lower the number, the less memory is used and the slower the restore will run. Default value is 100.-servername <name>. Server name. Used for dynamic property file finding.-webapp <dir>. Webapp's root folder. If not provided, the current directory is used.-webappname <name>. Webapp name. Used for dynamic property file finding. If not provided, the directory name of the webapp is used.
./bin/restore -backup /path/to/backup/backup_0812305_1234 -webapp /path/to/magnolia/webapp
For safety reasons we recommend you try to run the restore from time to time on a test system to verify validity of the backup files. Depending on the amount of data changed over the time you might want to do so every month or every quarter.
Deleting search indexes
Backup data does not contain search indexes. They are created on the fly when running restore. The indexer runs asynchronously and it might happen that the indexer is not finished when restore is done. This leads to situation where not all indexes are yet generated after restore.
It is therefore recommended to remove all the indexes before starting up restored instance to make sure those are freshly generated on startup (might take couple of minutes). To remove indexes just delete all index folders from the workspaces. On unix systems you can do so by executing rm -rf repositories/magnolia/workspaces/*/index.
Database size
During restore all entries are reinserted into the database sequentially. This ensures that the restored database is not fragmented and is usually slighter smaller than equivalent database before backup.
Changing persistence managers
You can use backup/restore to migrate data to another persistence manager, and therefore also to another database. To change the persistence manager configuration into which therestore script will try to restore the database, unzip all entries from repoConfig.zip (you can find this file inside each backup folder) and change the persistence manager configuration in each file as appropriate. Then zip all the files and run the restore.