Magnolia 4.5 reached end of life on June 30, 2016. This branch is no longer supported, see End-of-life policy.
The 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 provides immediate interactive backup of JackRabbit backed repositories and scheduled recurring backup support with cron-like configuration options.
Download the Backup module from the Magnolia Store or Nexus repository
Backup is an enterprise module (Magnolia 3.6+) 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.
The backup
and restore
scripts are in the bin
directory in the Backup module bundle. Download the bundle from the Magnolia Store and extract the zip file.
See the general module uninstalling instructions and advice.
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 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. Keep your backup files in a secure location.
To configure scheduled backup:
/modules/backup/config/
and create a new entry. See the preconfigured weekly backup
task as example.You also can create a backup manually with the backup
script. Make sure you provide the options -backup and -webapp.
Usage example:
./bin/backup -backup /path/to/directory/to/store/the/backup -webapp /path/of/the/context/to/backup/for-instance/magnoliaAuthor
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. Run the script before starting Magnolia 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. Perform a backup of this new instance. After that, shutdown the server, delete the repositories
directory and run the restore as specified below.
Usage:
restore [options]
Options:
-backup <dir>
. Backup folder.-help
-lib <dir>
. Directory containing Magnolia's jar files. Default is the webapp's directory suffixed with WEB-INF/lib/
.-propertyfiles <arg>
. List of property files to load. By default, files specified in web.xml
are used. If the properties are not specified in web.xml
, default configuration properties are used.-saveAfter <num>
. Persistence counter. The lower the number, the less memory is used and the slower the restore runs. Default value is 100.-servername <name>
. Server name. Used for dynamic property file finding.-webapp <dir>
. Webapp's root folder. Default is the current directory.-webappname <name>
. Webapp name. Used for dynamic property file finding. Default is the directory name of the webapp.Example:
./bin/restore -backup /path/to/backup/backup_0812305_1234 -webapp /path/to/magnolia/webapp
Tip
Assign the restore script more memory by changing the EXTRA_JVM_ARGUMENTS
variable in the script file. On a Linux server you need to grant the correct permissions to the script file in order to run it.
Best practice
For safety reasons, run the restore from time to time on a test system to verify the validity of the backup files. Depending on the amount of data changed over the time, perhaps do so every month or every quarter.Backup data does not contain search indexes. Indexes are created on the fly when running restore. As the indexer runs asynchronously, the indexing may still be in progress when restore is done. For this reason, we recommend that you remove all indexes before starting up a restored instance. This ensures that indexes are freshly generated on startup (Note that this process can take a 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
.
During restore all entries are reinserted into the database sequentially. This ensures that the restored database is not fragmented and is slightly smaller than the equivalent database before backup.
You can use backup/restore to migrate data to another persistence manager and to another database.
To change the persistence manager configuration to which the restore
script restores the database:
repoConfig.zip
. You can find this file inside each backup folder. This step is not necessary if you performed a backup of the new instance. Get the repoConfig.zip
file from that backup and run the restore script.