Repository backup

From OpenKM Documentation
Jump to: navigation, search

OpenKM backup depends on repository configuration. By default, all documents are stored in $TOMCAT_HOME/repository. This default folder can be changed using the property repository.home in the file OpenKM.cfg. If you want to make a backup, you should keep a copy of this folder.


Nota clasica.png Keep on mind that OpenKM by default use the embedded Hypersonic database, which files are located at $TOMCAT_HOME/repository. If you configure another database ad MySQL you need to backup this database, and not the previous Hypersonic files.


Nota advertencia.png It is recommended to stop Tomcat before start the backup to prevent file modifications in the middle of the process because can make the backup inconsistent.


Nota clasica.png This information is related to OpenKM 6.x so if you are using OpenKM 5.x please read Repository backup 5.x.

The backup process should have these steps:

  • Stop Tomcat
  • Backup important folders
  • Start Tomcat

In Unix / Linux you can backup the repository folder running these commands from $TOMCAT_HOME. First stop Tomcat:

$ ./bin/catalina.sh stop

Once Tomcat is stopped (you can see the Tomcat log to ensure it has stopped), make the backup:

$ tar czf repository.tgz repository

To check the backup, rename the repository folder:

$ mv repository repository-old

Restore the backup:

$ tar xzf repository.tgz

And start Tomcat:

$ ./bin/catalina.sh start

See also Backup scripts.

In Windows could be something like this:

  • Stop Tomcat
c:\tomcat-7.0.27\bin\catalina.bat stop
  • Make backup
xcopy c:\tomcat-7.0.27\*.* e:\Backup\ /s/e
  • Start Tomcat again
c:\tomcat-7.0.27\bin\catalina.bat start

The complete script may be like this one:

 c:\tomcat-7.0.27\bin\catalina.bat stop
 xcopy c:\tomcat-7.0.27\*.* e:\Backup\ /s/e
 c:\tomcat-7.0.27\bin\catalina.bat start

There's a little problem in default shutdown.bat and run.bat script because makes a pause at ends, you might delete the final line in both scripts

if "%NOPAUSE%" == "" pause

Alternative backup procedure

There is an alternative method for backups: you can export the whole repository from OpenKM administration. The folder structure will be re-created in the local filesystem, and all document on them. OpenKM 6.x can export document related metadata, but in older versions you can't and will lose the document history and other metadata like Property Groups.


Nota idea.png Ensure you have enough free disk space before perform this operation.

This export is only of the document repository and won't backup all other information stored in OpenKM database as user, roles, property groups definitions, workflows, mail accounts, etc.