Red Hat Training

A Red Hat training course is available for Red Hat Satellite

18.2. Restoring Red Hat Satellite from Backup

The following process describes a full Red Hat Satellite restoration. This process deletes all data from an existing Red Hat Satellite instance. During this process, ensure that:
  • You restore to the correct instance. The Red Hat Satellite instance must have the same configuration, package versions and errata as the original system.
  • All commands are executed as root in the directory where the archives were created during the backup process.
  • All SELinux contexts are correct. Run the following command to restore the correct SELinux contexts:
    restorecon -Rnv /
    

Warning

The following procedure deletes all data from an existing Red Hat Satellite instance.

Procedure 18.7. To Restore a Red Hat Satellite Instance:

  1. Prepare the Red Hat Satellite host for restoration. This process restores the backup to the same server that generated the backup. If the original system is unavailable, provision the same configuration with the same settings (host name, IP address, and so on) and run katello-installer with the same options using the file from the configuration backup:
    # tar --selinux -xzvf config_files.tar.gz -C /tmp
    # katello-configure --answer-file=/etc/katello-installer/answers.katello-installer.yaml
  2. Configure and change to the backup directory.
    # export BDIR=/backup
    # chgrp postgres -R $BDIR
    # cd $BDIR
  3. Determine the name of the Red Hat Satellite PostgreSQL database. The default name is foreman and is specified in the /usr/share/katello-installer/modules/foreman/manifests/database/postgresql.pp file. If you chose a different name for your database, it is stored as the value of db_database in the /etc/katello-installer/answers.katello-installer.yaml file.

    Note

    If you used the default database name, this variable has no value in the answers.katello-installer.yaml file.
    The Candlepin database name, candlepin, is not currently user configurable. It is specified in the /usr/share/katello-installer/modules/candlepin/manifests/init.pp file.
  4. Stop all services prior to restoring the databases:
    # katello-service stop
    # service postgresql stop
    
  5. Restore the system files. Make sure that the files extract on the correct host. Run the following commands in the backup directory to restore all system files:
    # tar --selinux -xzvf config_files.tar.gz -C /
    # tar --selinux -xzvf elastic_data.tar.gz -C /
    # tar --selinux -xvf pulp_data.tar -C /
  6. Drop any existing Red Hat Satellite PostgreSQL databases:
    # service postgresql start
    # runuser - postgres -c "dropdb foreman"
    # runuser - postgres -c "dropdb candlepin"

    Note

    The following error might appear during a database drop:
    database xxx is being accessed by other users
    This typically means that some Satellite processes are still running. Ensure all processes are stopped.
  7. Run the following commands to restore the Red Hat Satellite PostgreSQL databases:
    # runuser - postgres -c "pg_restore -C -d postgres /backup/katello.dump"
    # runuser - postgres -c "pg_restore -C -d postgres /backup/candlepin.dump"
  8. Ensure MongoDB is running and delete the old data:
    # service mongod start
    # echo 'db.dropDatabase();' | mongo pulp_database
  9. Run the following command in the /backup directory to restore the MongoDB database:
    # mongorestore --host localhost mongo_dump/pulp_database/
  10. Restart all Red Hat Satellite processes:
    # service postgresql start
    # katello-service start
    
  11. Inspect the appropriate log files for errors, and inspect the audit.log file for AVC denials. Attempt to ping the Red Hat Satellite instance:
    # hammer -u admin -p admin ping
If no errors are apparent, and you can ping the Satellite Server, the restoration should be complete and successful.
Further Reading