Repository mirroring

From OpenKM Documentation
Revision as of 15:02, 13 March 2010 by Wangmj (talk | contribs)

Jump to: navigation, search

To enhance OpenKM availability you can have two instances of the application running in different servers. If the principal server gets down due to a hardware failure you can switch to the mirrored server and keep working.

Okm installation guide 018.png

The replication only is done in one direction: from main server to mirror server. Mirror server can be configured to be in read-only mode so users can't add or modify documents. This behavior can be achieved using the system.readonly configuration parameter.

The follow script will propagate the repository changes from main server to mirror server:

echo -e "### BEGIN: $(date +"%x %X") ###\n"

# Stop local JBoss

# Stop remote JBoss
ssh root@ '/home/openkm/OpenKM/'

# Sync OpenKM repositories
rsync -rahe 'ssh -p 22022' --stats --delete --exclude OpenKM/OpenKM.cfg --exclude OpenKM/server/default/log /home/openkm/OpenKM

# Start local JBoss
/etc/init.d/jboss start

# Start remote JBoss
ssh root@ '/etc/init.d/jboss start'

echo -e "\n### END: $(date +"%x %X") ###"

This script should be executed - by user root - from the main server, and can be scheduled to be executed every day using Linux cron utility, for example. The script uses rsync to minimize network load and only modified or added documents will be transferred. The whole process can take a few minutes, depending on your repository activity.

Note that both OpenKM are installed at the openkm user home (/home/openkm) for simplicity.

And this is the script:


# Stop JBoss
/etc/init.d/jboss stop
while [ "$(ps -ef | grep java | grep jboss | wc -l)" -gt "0" ]; do
   sleep 5; echo ".";