Apache Jackrabbit : BackupAndMigration

Repository Backup and Migration

Export to XML

The JCR API provided two ways to export data as XML. To create XML documents of a node and it's subnodes, use Session.exportDocumentView(..) or Session.exportSystemView(..). To restore a backup, use Session.importXML(..) or Workspace.importXML(..).

Repository Migration

An easy way to migrate a repository to a new persistence manager, or to use the data store, is by exporting the data to XML and then re-importing it in the new repository. However, depending on the size of the repository, this solution make be slow or run out of memory.


Repository Copier Tool

Jackrabbit 1.6 and newer supports a tool to copy a repository:
RepositoryCopier API

This tool does NOT use the standard JCR API. It uses the internal API of the current Jackrabbit core.

The RepositoryCopier doesn't contain any protection against concurrent changes to the repository. If you allow clients to modify the repository while you're backing it up, you may end up with an inconsistent backup.


Some JCR tools provide backup facilities, for example JeCARS. See Backup Facility for details.

Low Level Backup

Backing up the file system (and database if used) is the fastest solution.

Files of the file DataStore can be backed up at any time, because the files are never modified. You should make sure not to backup the temp files however.

File system persistence managers: the files are not be locked, but the problem is atomicy: Backing up files while they are modified is problematic. Files should be backed up only if the repository is not running.

Database persistence managers: many databases support online backup, so if you use that you should be safe.

You also need to backup the repository directory, but this doesn't change usually.