Skip to content

Restore

John Mitsch edited this page May 17, 2018 · 5 revisions

Table of contents

Restore

Note: We assume all the foreman-maintain commands are run as a root user.

foreman-maintain restore will restore any backup created using foreman-maintain backup or katello-backup. To restore your backup, run foreman-maintain restore <BACKUP_DIR>. All available options can be found with foreman-maintain restore --help.

Important Warning

Restore will drop databases and reset using foreman/satellite-installer. After this, the databases are restored from backup. The command will display a yes/no prompt that can be bypassed using the -y flag. The warning looks like this:

WARNING: This script will drop and restore your database.
Your existing installation will be replaced with the backup database.
Once this operation is complete there is no going back.
Do you want to proceed?, [y(yes), q(quit)] y

Supported systems

Restore works on the following:

  • Katello
  • Foreman-proxy with content
  • Satellite (>=6.3)
  • Capsule (>=6.3)

Backup Verification

The command will verify your backup has the correct files for the associated system present in the directory. This looks like the following (ran on katello system):

The given directory does not contain the required files or has too many files

All backup directories contain: config_files.tar.gz
An online or remote database backup directory contains: mongo_dump, candlepin.dump, foreman.dump
An offline backup directory contains: mongo_data.tar.gz, pgsql_data.tar.gz
A logical backup directory contains: mongo_dump, candlepin.dump, foreman.dump, mongo_data.tar.gz, pgsql_data.tar.gz
Including pulp_data.tar is optional and will restore pulp data to the filesystem if included.

Restore Incremental Backups

You must restore incremental backups by first restoring the full backup, then the incremental backups in order sequentially starting with the oldest. i.e.

foreman-maintain restore /tmp/backups/FULL_BACKUP
foreman-maintain restore -i /tmp/backups/FIRST_INCREMENTAL
foreman-maintain restore -i /tmp/backups/SECOND_INCREMENTAL

In case you have multiple “branches” of incremental backups, you need to pick your full backup and each incremental one for the “branch” you wish to restore, in the order they were taken.

The previous incremental backup is kept in the backup's metadata.yml file under the incremental key. i.e:

incremental: /backup/offline-full/

Foreman-maintain will check for this key in metadata when restoring, -i is not needed for backups taken with foreman-maintain, but it is there to support older backups without that key present in the metadata.

After Restore

Once the procedure is finished, all processes will be online, and all databases and system configuration will be reverted to the state and the time of the backup.

Check log files for errors, such as /var/log/foreman/production.log and /var/log/messages.