Difference between revisions of "Repository backup 5.x"

From OpenKM Documentation
Jump to: navigation, search
 
(9 intermediate revisions by 2 users not shown)
Line 1: Line 1:
OpenKM backup depends on repository configuration. By default, all documents are stored in $JBOSS_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. Is also recommended to backup files located at ''$JBOSS_HOME/server/default/data/hypersonic'' because there are several databases which handle important data:
+
OpenKM backup depends on repository configuration. By default, all documents are stored in $JBOSS_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. Is also recommended to backup files located at ''$JBOSS_HOME/server/default/data/hypersonic'' because there are several databases which handle important data.
  
* '''OKMActivity''': Stores the user activity log. All the actions performed by an user in OpenKM are logged. Only the administrator user can access this log and search for specific actions and users. This database can be very big if there are many users and make an intensive use of the application.
+
{{Note|Keep on mind that OpenKM by default use the embedded Hypersonic database, which files are located at ''$JBOSS_HOME/server/default/data/hypersonic''. If you configure another database ad MySQL you need to backup this database, and not the previous Hypersonic files.}}
 
 
* '''OKMAuth''': This database is used to manage authentication. All the users, roles and passwords are here, so take care of it. If this database is damaged, you won't be able to log into OpenKM.
 
 
 
* '''OKMDashboard''': Is used to keep the visited items of the dashboard.
 
 
 
* '''OKMWorkflow''': Is used to store the process definitions and process instance data. Also is used to manage task and node transitions.
 
  
 
{{Warning|It is recommended to stop JBoss before start the backup to prevent file modifications in the middle of the process because can make the backup useless.}}
 
{{Warning|It is recommended to stop JBoss before start the backup to prevent file modifications in the middle of the process because can make the backup useless.}}
Line 37: Line 31:
 
  $ ./bin/run.sh
 
  $ ./bin/run.sh
  
This backup script uses rsync to minimize network load and creates incremental backups, preserving last four backups.
+
See also [[Backup scripts]].
 
 
<source lang="bash">
 
#!/bin/bash
 
#
 
## BEGIN CONFIG ##
 
HOST=$(uname -n)
 
FILES="/home/openkm"
 
## END CONFIG ##
 
echo -e "### BEGIN: $(date +"%x %X") ###\n"
 
 
 
# Stop JBoss
 
/etc/init.d/jboss stop
 
while [ "$(ps -ef | grep java | grep jboss | wc -l)" -gt "0" ]; do
 
  sleep 5; echo ".";
 
done
 
 
 
# Copy to backup server
 
ssh backup@server "cd $HOST; rm -rf backup.3; mv backup.2 backup.3; mv backup.1 backup.2; mv backup.0 backup.1"
 
rsync -apzhR --stats --delete --exclude=*~ --delete-excluded --link-dest="/home/backup/$HOST/backup.1" $FILES backup@server:/home/backup/
 
$HOST/backup.0
 
 
 
# Start JBoss
 
/etc/init.d/jboss start
 
echo -e "\n### END: $(date +"%x %X") ###"
 
</source>
 
 
 
For more info, read http://www.mikerubel.org/computers/rsync_snapshots/.  
 
 
 
  
 
'''In Windows''' could be something like this:
 
'''In Windows''' could be something like this:
  
Stoping jboss
+
* Stop JBoss
 
  c:\jboss\bin\shutdown.bat -S
 
  c:\jboss\bin\shutdown.bat -S
  
Making backup
+
* Make backup
 
  xcopy c:\jboss-4.2.3.GA\*.* e:\Backup\ /s/e
 
  xcopy c:\jboss-4.2.3.GA\*.* e:\Backup\ /s/e
  
Starting jboss
+
* Start JBoss again
 
  c:\jboss-4.2.3.GA\bin\run.bat -b 0.0.0.0
 
  c:\jboss-4.2.3.GA\bin\run.bat -b 0.0.0.0
  
Complete script could be like this.
+
The complete script may be like this one:
+
 
 +
<source lang="dos">
 
  c:\jboss\bin\shutdown.bat -S
 
  c:\jboss\bin\shutdown.bat -S
 
  xcopy c:\jboss-4.2.3.GA\*.* e:\Backup\ /s/e
 
  xcopy c:\jboss-4.2.3.GA\*.* e:\Backup\ /s/e
 
  c:\jboss-4.2.3.GA\bin\run.bat -b 0.0.0.0
 
  c:\jboss-4.2.3.GA\bin\run.bat -b 0.0.0.0
 +
</source>
  
 
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
 
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
+
 
 +
<source lang="dos">
 +
if "%NOPAUSE%" == "" pause
 +
</source>
  
 
{{Note|Due to Jackrabbit flexibility you can configure your OpenKM installation to store the documents in a database, for example. In this case you have to modify the backup procedure. Anyway the $JBOSS_HOME/repository folder should be backup because it
 
{{Note|Due to Jackrabbit flexibility you can configure your OpenKM installation to store the documents in a database, for example. In this case you have to modify the backup procedure. Anyway the $JBOSS_HOME/repository folder should be backup because it
contains repository medatada.}}
+
contains repository meta data.}}
  
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 but you will lose the document history and other metadata like Property Groups.
+
== 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. Since '''OpenKM 5.1.9 also can export document related metadata''', but in older versions you can't and will lose the document history and other metadata like Property Groups.
  
 
{{Advice|Ensure you have enough free disk space before perform this operation.}}
 
{{Advice|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.
  
 
[[Category: Installation Guide]]
 
[[Category: Installation Guide]]

Latest revision as of 11:07, 29 November 2012

OpenKM backup depends on repository configuration. By default, all documents are stored in $JBOSS_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. Is also recommended to backup files located at $JBOSS_HOME/server/default/data/hypersonic because there are several databases which handle important data.


Nota clasica.png Keep on mind that OpenKM by default use the embedded Hypersonic database, which files are located at $JBOSS_HOME/server/default/data/hypersonic. 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 JBoss before start the backup to prevent file modifications in the middle of the process because can make the backup useless.

The backup process should have these steps:

  • Stop JBoss
  • Backup important folders
  • Start JBoss

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

$ ./bin/shutdown.sh -S

Once JBoss is stopped (you can see the JBoss 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 JBoss:

$ ./bin/run.sh

See also Backup scripts.

In Windows could be something like this:

  • Stop JBoss
c:\jboss\bin\shutdown.bat -S
  • Make backup
xcopy c:\jboss-4.2.3.GA\*.* e:\Backup\ /s/e
  • Start JBoss again
c:\jboss-4.2.3.GA\bin\run.bat -b 0.0.0.0

The complete script may be like this one:

 c:\jboss\bin\shutdown.bat -S
 xcopy c:\jboss-4.2.3.GA\*.* e:\Backup\ /s/e
 c:\jboss-4.2.3.GA\bin\run.bat -b 0.0.0.0

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

Nota clasica.png Due to Jackrabbit flexibility you can configure your OpenKM installation to store the documents in a database, for example. In this case you have to modify the backup procedure. Anyway the $JBOSS_HOME/repository folder should be backup because it contains repository meta data.

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. Since OpenKM 5.1.9 also 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.