This chapter describes the backup and restore of the OTRS data.
There are two types of data to backup: application files (e.g. the files in
/opt/otrs), and the data stored in the database.
To simplify backups, the script
scripts/backup.pl is included with every OTRS installation. It can be run to backup all important data (see Script below).
linux:/opt/otrs# cd scripts/ linux:/opt/otrs/scripts# ./backup.pl --help backup.pl - backup script Copyright (C) 2001-2021 OTRS AG, https://otrs.com/ usage: backup.pl -d /data_backup_dir/ [-c gzip|bzip2] [-r 30] [-t fullbackup|nofullbackup|dbonly] linux:/opt/otrs/scripts#
Script: Getting help about the OTRS backup mechanism.
Execute the command specified in the script below to create a backup:
linux:/opt/otrs/scripts# ./backup.pl -d /backup/ Backup /backup//2010-09-07_14-28/Config.tar.gz ... done Backup /backup//2010-09-07_14-28/Application.tar.gz ... done Dump MySQL rdbms ... done Compress SQL-file... done linux:/opt/otrs/scripts#
Script: Creating a backup.
All data was stored in the directory
/backup/2010-09-07_14-28/ (see Script below). Additionally, the data was saved into a .tar.gz file.
linux:/opt/otrs/scripts# ls /backup/2010-09-07_14-28/ Application.tar.gz Config.tar.gz DatabaseBackup.sql.gz linux:/opt/otrs/scripts#
Script: Checking the backup files.
To restore a backup, the saved application data has to be written back into the installation directory, e.g.
/opt/otrs. Also the database has to be restored.
scripts/restore.pl (see Script below), which simplifies the restore process, is shipped with every OTRS installation. It supports MySQL and PostgreSQL.
linux:/opt/otrs/scripts# ./restore.pl --help restore.pl - restore script Copyright (C) 2001-2021 OTRS AG, https://otrs.com/ usage: restore.pl -b /data_backup/<TIME>/ -d /opt/otrs/ linux:/opt/otrs/scripts#
Script: Getting help about the restore mechanism.
Data that is stored, for example, in the directory
/backup/2010-09-07_14-28/, can be restored with the command specified in the script below, assuming the OTRS installation is at
linux:/opt/otrs/scripts# ./restore.pl -b /backup/2010-09-07_14-28 -d /opt/otrs/ Restore /backup/2010-09-07_14-28//Config.tar.gz ... Restore /backup/2010-09-07_14-28//Application.tar.gz ... create MySQL decompresses SQL-file ... cat SQL-file into MySQL database compress SQL-file... linux:/opt/otrs/scripts#
Script: Restoring OTRS data.