Backups

From DoKSwiki

This is a short manual to help you backup your DoKS installation and to restore your data in case of a system crash. There are two different things you have to backup: your data (files) and your database. Another possibility is to use the DoKS export function to export all metadata and data.

Table of contents

Backup your data

The easiest way to have backups of all the files stored in your DoKS system is to put the data directory in your standard backup procedure. Your data directory is assigned by the value of "upload.perm.dir" in the config file doks/conf/doks.properties. Make sure all the directories and their files are properly backed up.

Backup your database

Backup

The best way to backup a mysql database is to dump all the data into one dump file regularly. The basic command to do so is mysqldump -u root -p your_database > your_datadirectory/dumpfile.sql.
E.g. mysqldump -u root -p eindwerk > /data/eindwerk.sql

Restore

Here's how to restore a database from a dump file:

  • make sure a database with the right name exists (drop it and create it again)
    • drop database your_database
    • create database your_database
  • use the dumpfile to insert the data into the database
    • mysql -u root -p your_database < your_datadirectory/dumpfile.sql

Export your metadata and data

As described in the Complete installation Manual#import and export, DoKS offers an export function to export all metadata and data. The directory where all the exported data is stored is assigned in the doks/conf/doks.properties file in the "importexport.dir" value. The data itself is stored in the folders. The names of the folders are the same as the fulltext recordID's. The metadata is stored in xml files: fileformats.xml, users.xml, scripts.xml, folders.xml and records.xml.

File formats

ant exportfileformats[ -Ddir=importdir][ -Dfile=xmlfile]

This will export all the file formats from/to an XML file.

exportdir is default the value of importexport.dir in doks.properties

xmlfile is default fileformats.xml

Users and user groups

ant exportusers[ -Ddir=importdir][ -Dfile=xmlfile]

This will export all the users and user groups from/to an XML file.

exportdir is default the value of importexport.dir in doks.properties

xmlfile is default users.xml

Scripts

ant exportscripts[ -Ddir=importdir][ -Dfile=xmlfile]

This will export all the scripts from text files with .bsh as extension (BeanShell scripts). The permissions can be found in the XML file.

exportdir is default doks_home/data/scripts

xmlfile is default scripts.xml

Folders

ant exportfolders[ -Ddir=importdir][ -Dfile=xmlfile][ -Dfolder=folder_path]

This will export folders from/to an XML file.

exportdir is default the value of importexport.dir in doks.properties

xmlfile is default folders.xml

folder_path is the path to the folder that you want to export (this folder and all of its sub folders are exported). This is default the root folder with path /, meaning that all existing folders are exported.

Records

ant exportrecords[ -Ddir=importdir][ -Dfile=xmlfile][ -Dfolder=folder_path]

This will export records to an XML file.

Exportdir is default the value of importexport.dir in doks.properties

xmlfile is default records.xml

folder_path is the path to the folder from which you want to export the records (the records in this folder and all of its sub folders are exported). This is default the root folder with path /, meaning that all records are exported.