Repository Backup
You can back up a Jackrabbit repository in the following ways:
Low level backup (file system / database)
Export to XML using the JCR API
Using a tool
Low Level Backup
Backing up the file system (and database if used) is the solution fastest.
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.
Export to 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(..).
Using a Tool
Some JCR tools provide backup facilities, for example
JeCARS. See
Backup Facility for details.
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.