Bookmark this page

Guided Exercise: Configure Backup and Restore Operations

Back up and restore the Satellite Server configuration and database.

Outcomes

  • Perform a full backup of a Satellite Server.

  • Locate and identify backup files.

  • Restore an operational Satellite Server from a backup.

As the student user on the workstation machine, use the lab command to prepare your system for this exercise.

This command prepares your environment and ensures that all required resources are available.

[student@workstation ~]$ lab start maintain-backup

Instructions

You must create a Satellite Server backup as part of a disaster recovery plan. The Satellite Server's Pulp package content that is stored in the file system was previously backed up in a regular system backup. You must back up only the Satellite configuration and database contents.

  1. Log in to the satellite system as the student user and switch to the root user.

    [student@workstation ~]$ ssh satellite
    [student@satellite ~]$ sudo -i
    [sudo] password for student: student
    [root@satellite ~]#
  2. Create a backup of the Satellite Server configuration and database.

    1. Create the /var/tmp/backup directory to store backup data.

      [root@satellite ~]# mkdir /var/tmp/backup
    2. Create an offline backup of the Satellite Server that excludes the Pulp content. Note the name of the subdirectory that the backup command creates under the /var/tmp/backup directory.

      [root@satellite ~]# satellite-maintain backup offline --skip-pulp-content \
      /var/tmp/backup
      ...output omitted...
      Do you want to proceed?, [y(yes), q(quit)] y
      ...output omitted...
      Done with backup: 2022-07-25 06:15:51 -0400
      **** BACKUP Complete, contents can be found in: /var/tmp/backup/satellite-backup-2022-07-25-06-13-04 ****
  3. Explore the contents of the backup subdirectory from the previous command output. Your file name, size, and other attributes would differ from this example.

    [root@satellite ~]# ls -l /var/tmp/backup
    total 0
    drwxrwx---. 2 root postgres 120 Jul 25 06:15 satellite-backup-YYYY-MM-DD-HH-MM-SS
    [root@satellite ~]# du -sh /var/tmp/backup/satellite-backup-YYYY-MM-DD-HH-MM-SS
    457M	/var/tmp/backup/satellite-backup-YYYY-MM-DD-HH-MM-SS
    [root@satellite ~]# ls -l /var/tmp/backup/satellite-backup-YYYY-MM-DD-HH-MM-SS
    total 467508
    -rw-r--r--. 1 root root  16121185 Jul 25 06:13 config_files.tar.gz
    -rw-r--r--. 1 root root     55390 Jul 25 06:13 metadata.yml
    -rw-r--r--. 1 root root 462548521 Jul 25 06:13 pgsql_data.tar.gz
  4. On Satellite Server, modify an object in the Satellite Server, so you can test for a successful Satellite Server restore. Update the admin user description, and create a user called backtest. These user changes are not in the backup from the previous step. When you successfully restore that backup, these two user changes are overwritten.

    1. Log in to the Satellite Server web UI, https://satellite.lab.example.com, as the admin user with redhat as the password.

    2. Click AdministerUsers, and click the admin user link. Modify the Description field to Modified admin user description. Click Submit.

    3. Click Create User. On the User tab, enter the information for the following fields. Leave the other fields unchanged. Click Submit.

      FieldValue
      Username backtest
      Email Address root@satellite.lab.example.com
      Authorized by INTERNAL
      Password redhat
      Verify redhat
    4. Log out of the admin user.

  5. Restore the Satellite Server to the previous state before you created the user changes. The restore process takes approximately 20 minutes.

    1. In the terminal on the satellite system, restore the Satellite backup. Provide the subdirectory name from the previous backup command output. Wait for the restore to complete.

      [root@satellite ~]# satellite-maintain restore \
      /var/tmp/backup/satellite-backup-YYYY-MM-DD-HH-MM-SS
      ...output omitted...
      Do you want to proceed?, [y(yes), q(quit)] y
  6. When the restore is complete, verify that the Satellite Server is restored.

    1. Log in to the Satellite Server web UI, https://satellite.lab.example.com, as the admin user with redhat as the password.

    2. Verify that the restore is successful. Click AdministerUsers. The backtest user does not exist.

    3. Select the admin user. The Description field is restored to its original value.

  7. To free space in your disk, remove the backup files.

    [root@satellite ~]# rm -rf /var/tmp/backup
  8. Return to the workstation system as the student user.

    [root@satellite ~]# exit
    logout
    [student@satellite ~]$ exit
    logout
    [student@workstation ~]$

Finish

On the workstation machine, change to the student user home directory and use the lab command to complete this exercise. This step is important to ensure that resources from previous exercises do not impact upcoming exercises.

[student@workstation ~]$ lab finish maintain-backup

Revision: rh403-6.11-3ad886e