Backup restoring 5.x

From OpenKM Documentation
Revision as of 12:17, 27 December 2012 by Jllort (talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

In cause of a hardware failure you may need to restore a backup. Backups are very important for OpenKM because you store a lot of documentation on it.

First of all, we need to locate the right backup. In case of rdiff-backup you can list with:

$ rdiff-backup --list-increment-sizes /path/to/backup
Sun Sep 11 05:00:19 2011         4.25 GB           4.25 GB   (current mirror)
Sun Sep  4 00:00:18 2011         13.3 MB           4.26 GB
Sun Aug 28 00:00:13 2011          674 MB           4.92 GB
Sun Aug 21 00:00:14 2011         5.50 MB           4.93 GB
Sun Aug 14 00:00:16 2011         1.75 MB           4.93 GB
Sun Aug  7 00:00:12 2011          288 KB           4.93 GB
Sun Jul 31 00:00:13 2011         43.0 KB           4.93 GB
Fri Jul 29 10:36:39 2011         5.56 KB           4.93 GB

Then we have decided to restore the backup of made on Sun Aug 28 00:00:13 2011:

$ rdiff-backup --restore-as-of 2011-08-28 /path/to/backup /path/to/destination

The --restore-as-of parameter accepts several formats. See rdiff-backup documentation for more info.

Inside of /path/to/destination you should see a directory /home/openkm, and inside it a couple of directories:

  • db: The backup of the database.
  • jboss-4.2.3.GA: The backup of the JBoss installation.

Nota clasica.png The default OpenKM installation uses an embedded database called Hipersonic. So, the db directory may not exists, because all the needed info is under the jboss-4.2.3.GA directory. Refer to Using OpenKM with other databases for more info.

In case you have a MySQL database configured, these are the steps:

DROP DATABASE IF EXISTS okm_repo_bak;
DROP DATABASE IF EXISTS okm_app_bak;

CREATE DATABASE okm_repo_bak DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_bin;
CREATE DATABASE okm_app_bak DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_bin;

GRANT ALL ON okm_repo_bak.* TO openkm@localhost WITH GRANT OPTION;
GRANT ALL ON okm_app_bak.* TO openkm@localhost WITH GRANT OPTION;

Nota clasica.png We have already created a openkm user when the database was created on OpenKM installation. If you want to restore the backuped databases in another MySQL installation you will need to create this user. Refer to MySQL-OpenKM 5.0 for more info.

Now restore the previous backup to these new databases:


Nota advertencia.png Be careful and don't restore the data into the wrong database because you can damage your current OpenKM installation.

$ mysql -h localhost -u openkm -p okm_repo_bak < db/mysql_okm_repo.sql
$ mysql -h localhost -u openkm -p okm_app_bak < db/mysql_okm_app.sql

Copy the jboss-4.2.3.GA to /home/openkm/jboss-4.2.3.GA_bak and modify these configuration files to use the new backuped databases:

  • repository.xml
  • server/default/deploy/openkm-ds.xml

Stop the current JBoss (from /home/openkm/jboss-4.2.3.GA) and start the new one (/home/openkm/jboss-4.2.3.GA_bak). Log into the restored OpenKM and make a Repository export from Administration. Once completed, stop the backuped JBoss and start the original one. Then go to Administration > Repository import and import the desired content.


Nota idea.png In case of a complete restore from backup, you don't need to create the okm_repo_bak and okm_app_bak database nor modify and start the backuped JBoss.