Difference between revisions of "Backup restoring"

From OpenKM Documentation
Jump to: navigation, search
 
Line 1: Line 1:
#REDIRECT [[Backup restoring 5.x]]
+
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.
 +
 
 +
{{Note|This guide is for OpenKM 6.x but if you are using OpenKM 5.x you should read [[Backup restoring 5.x]].}}
 +
 
 +
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.
 +
* '''tomcat-7.0.27''': The backup of the Tomcat installation.
 +
 
 +
{{Note|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 '''tomcat-7.0.27''' directory. Refer to [[Using OpenKM with other databases]] for more info.}}
 +
 
 +
In case you have a MySQL database configured, these are the steps:
 +
 
 +
<source lang="sql">
 +
DROP DATABASE IF EXISTS okmdb_bak;
 +
CREATE DATABASE okmdb_bak DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_bin;
 +
GRANT ALL ON okmdb_bak.* TO openkm@localhost WITH GRANT OPTION;
 +
</source>
 +
 
 +
{{Note|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 6.2]] for more info.}}
 +
 
 +
Now restore the previous backup to these new databases:
 +
 
 +
{{Warning|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 okmdb_bak < db/mysql_okmdb.sql
 +
 
 +
Copy the '''tomcat-7.0.27''' to '''/home/openkm/tomcat-7.0.27_bak''' and modify these configuration files to use the new backuped database:
 +
 
 +
* conf/server.xml
 +
 
 +
Stop the current Tomcat (from '''/home/openkm/tomcat-7.0.27''') and start the new one ('''/home/openkm/tomcat-7.0.27_bak'''). Log into the restored OpenKM and make a '''Repository export''' from '''Administration'''. Once completed, stop the backuped Tomcat and start the original one. Then go to '''Administration''' > '''Repository import''' and import the desired content.
 +
 
 +
{{Advice|In case of a complete restore from backup, you don't need to create the '''okmdb_bak''' database nor modify and start the backuped Tomcat.}}
 +
 
 +
[[Category: Installation Guide]]
 +
[[Category: OKM Network]]

Revision as of 11:46, 29 November 2012

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.


Nota clasica.png This guide is for OpenKM 6.x but if you are using OpenKM 5.x you should read Backup restoring 5.x.

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.
  • tomcat-7.0.27: The backup of the Tomcat 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 tomcat-7.0.27 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 okmdb_bak;
CREATE DATABASE okmdb_bak DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_bin;
GRANT ALL ON okmdb_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 6.2 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 okmdb_bak < db/mysql_okmdb.sql

Copy the tomcat-7.0.27 to /home/openkm/tomcat-7.0.27_bak and modify these configuration files to use the new backuped database:

  • conf/server.xml

Stop the current Tomcat (from /home/openkm/tomcat-7.0.27) and start the new one (/home/openkm/tomcat-7.0.27_bak). Log into the restored OpenKM and make a Repository export from Administration. Once completed, stop the backuped Tomcat 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 okmdb_bak database nor modify and start the backuped Tomcat.