Chapter 8. Backing Up Satellite Server and Capsule Server

This chapter describes the minimum backup procedure to ensure the continuity of your Red Hat Satellite deployment and associated data in the event of a disaster. If your deployment uses custom configurations, you must consider how to handle these custom configurations when you plan your backup and disaster recovery policy.

8.1. Satellite Backup

A Satellite Server or a Capsule Server backup is a collection of archived database and configuration files that you can use to restore or debug Satellite or Capsule. Use the satellite-maintain backup utility to create a backup.

Types of backup

You can create the following types of backup:

Full

A complete backup of Satellite or Capsule.

Incremental

A backup of changes since a previous backup.

Without Pulp content

A partial backup without the Pulp database content.

Backup methods

You can use the following methods for performing a backup:

Offline

Create a backup by taking Satellite or Capsule offline.

Online

Create a backup with Satellite or Capsule online.

Snapshot

Create a backup from Logical Volume Manager (LVM) snapshots. Satellite or Capsule is offline while creating snapshots.

For more information on backup methods and types, see Section 8.10, “Backup Methods and Types”.

The satellite-maintain backup utility creates the backup in a time-stamped subdirectory in the directory that you specify. You can provide a different name for the subdirectory using the --preserve-directory option. If you use the --preserve-directory option, the subdirectory is not cleaned up when the backup fails.

For a Satellite or Capsule configured to use remote databases, the utility performs a database dump when performing offline or snapshot backup.

Backup considerations

  • Create backups regularly. For more information on scheduling a periodic backup with a cron job, see Section 8.9, “Example Script for Scheduling Offline Backups”.
  • To ensure backup safety, create the backup in a separate storage device on a separate system.
  • A backup contains sensitive information from the /root/ssl-build directory. For example, it can contain hostnames, ssh keys, request files and SSL certificates. Either encrypt or move the backup to a secure location to minimize the risk of damage or unauthorized access to the hosts.

8.2. Full Backup

A full Satellite or Capsule Server backup contains all the database and configuration files required to restore a Satellite or a Capsule instance.

Backup contents

A full backup contains the following files:

  • Compressed configuration files
  • Compressed MongoDB files
  • Compressed PostgreSQL database files
  • Pulp directory files
  • A configuration file containing Satellite environment details

Storage requirements

During a full backup, the files are copied and then compressed, therefore enough storage to hold both is required. Additionally, metadata files created during archiving and compression require extra space.

A full backup of Satellite or Capsule requires an amount of storage that is equal to the sum of the following:

  • Satellite databases and configuration files size
  • Compressed Satellite databases and configuration files size
  • 20% of the sum of the uncompressed and compressed databases and configuration files sizes

8.2.1. Estimating the Size of a Full Backup

To estimate the backup size, find the total space used by the database and configuration files. Use this result to calculate the backup size.

Procedure

  1. Find the size of the database and configuration files using the du command:

    # du -csh /var/lib/mongodb /var/lib/pgsql/data /var/lib/pulp /var/lib/qpidd /var/lib/tftpboot /etc /root/ssl-build /var/www/html/pub /opt/puppetlabs

    Example:

    # du -csh /var/lib/mongodb /var/lib/pgsql/data /var/lib/pulp /var/lib/qpidd /var/lib/tftpboot /etc /root/ssl-build /var/www/html/pub /opt/puppetlabs
    480G	/var/lib/mongodb
    100G    /var/lib/pgsql/data
    100G	/var/lib/pulp
    886M    /var/lib/qpidd
    16M     /var/lib/tftpboot
    37M     /etc
    900K	/root/ssl-build
    100K	/var/www/html/pub
    2M	    /opt/puppetlabs
    681G    total

    The size of the files in this example is 681 GB.

  2. Calculate the space required to store the compressed data using the above result:

    For information on estimating the size of the compressed data, see Section 8.7, “Backup Data Compression Ratio”.

    In this example, the compressed backup data requires 180 GB.

  3. Calculate the amount of additional free space required:

    The additional space required is 20% of the sum of compressed and uncompressed files. So, the additional space required is 178 GB in this example.

  4. Calculate the sum of the above results.

    In this example,

    Uncompressed size = 861 GB
    Compressed size = 180 GB
    Additional free space required = 172 GB
    Sum = 1033 GB

    The estimated size of the backup in this example is 1033 GB.

8.2.2. Performing a Full Backup Offline

Perform a full backup using the offline method. The backup process takes a long time to complete and the Satellite is unavailable during the process.

Prerequisites

Procedure

  1. Run the satellite-maintain backup script:

    # satellite-maintain backup offline /var/backup_directory
  2. Enter y when prompted to start the backup:

    Do you want to proceed?, [y(yes), q(quit)] y

    The backup process takes a long time to complete.

Additional Resources

8.2.3. Performing a Full Backup Online

To debug and troubleshoot issues, perform a full backup using the online method. Satellite remains available during the process.

To ensure a successful backup, do not perform the following operations until the backup is complete:

  • Publish, add, or delete content views
  • Promote content view versions
  • Add, change, or delete sync-plans
  • Add, delete, or sync repositories

The backup process takes a long time to complete.

Prerequisites

Procedure

  1. Run the satellite-maintain backup script:

    # satellite-maintain backup online /var/backup_directory
  2. Enter y when prompted to start the backup:

    Do you want to proceed?, [y(yes), q(quit)] y

    The backup process takes a long time to complete.

Additional Resources

8.3. Incremental Backup

An incremental backup contains the changes that occurred in the database and configuration files since a previously performed backup.

The first incremental backup is based on a full backup and any following incremental backups are based on previous ones. To restore Satellite using incremental backups, all the incremental backups and the first full backup are required.

8.3.1. Performing an Incremental Backup Offline

Perform an incremental backup using the offline method. Satellite is unavailable during the process.

Prerequisites

  • You have a previous backup available to use as a base for the incremental backup.
  • The postgres user has write permission to the backup directory.

Procedure

  1. Run the satellite-maintain backup script:

    # satellite-maintain backup offline --incremental /var/backup_dir/previous_backup_dir /var/backup_dir

    Replace the previous_backup_dir with the name of the previous backup that you are using as a base for the incremental backup.

  2. Enter y when prompted to start the backup:

    Do you want to proceed?, [y(yes), q(quit)] y

Additional Resources

8.3.2. Performing an Incremental Backup Online

To debug and troubleshoot issues, perform an incremental backup using the online method. Satellite remains available during the process.

To ensure a successful backup, do not perform the following operations until the backup is complete:

  • Publish, add, or delete content views
  • Promote content view versions
  • Add, change, or delete sync-plans
  • Add, delete, or sync repositories

Prerequisites

  • You have a previous backup available to use as a base for the incremental backup.
  • The postgres user has write permission to the backup directory.

Procedure

  1. Run the satellite-maintain backup script:

    # satellite-maintain backup online --incremental /var/backup_dir/previous_backup_dir /var/backup_dir

    Replace the previous_backup_dir with the name of the previous backup that you are using as a base for the incremental backup.

  2. Enter y when prompted to start the backup:

    Do you want to proceed?, [y(yes), q(quit)] y

Additional Resources

8.4. Backup Without Pulp Content

A backup without Pulp content excludes the repository information of Satellite or Capsule Server. Backing up repository information contained in the Pulp database is the most time intensive part of the Satellite backup process. You can skip backing up the Pulp database with the option --skip-pulp-content. This excludes backing up the /var/lib/pulp directory.

You cannot restore from a backup without Pulp content.

8.4.1. Performing a Backup Without Pulp Content Offline

To debug and troubleshoot issues, perform a backup without Pulp content using the offline method. Satellite is unavailable during the process.

Procedure

  1. Run the satellite-maintain backup script:

    # satellite-maintain backup offline --skip-pulp-content /var/backup_directory
  2. Enter y when prompted to start the backup:

    Do you want to proceed?, [y(yes), q(quit)] y

You can copy the contents of /var/lib/pulp using methods such as rsync or shared storage.

Additional Resources

8.4.2. Performing a Backup Without Pulp Content Online

To debug and troubleshoot issues, perform a backup without Pulp content using the online method. Satellite remains available during the process.

Procedure

  1. Run the satellite-maintain backup script:

    # satellite-maintain backup online --skip-pulp-content /var/backup_directory
  2. Enter y when prompted to start the backup:

    Do you want to proceed?, [y(yes), q(quit)] y

You can copy the contents of /var/lib/pulp using methods such as rsync or shared storage.

Additional Resources

8.5. Snapshot Backup

The snapshot backup method creates Logical Volume Manager (LVM) snapshots of Pulp, MongoDB and PostgreSQL databases and mounts the snapshots on a separate Logical Volume (LV).

The satellite-maintain backup utility creates snapshots when Satellite services are active, and stops only those services that impact the backup. Satellite or Capsule is unavailable only when the snapshot is created. After a successful backup, all the services are restarted and the LVM snapshots are removed. Performing a snapshot backup takes less time than performing a full backup offline, and reduces the Satellite or Capsule downtime.

8.5.1. Performing a Snapshot Backup

Perform a backup using the snapshot method. Satellite is unavailable when the LVM snapshot is created.

Prerequisites

  • The system uses LVM for the following directories:

    • /var/lib/pulp/
    • /var/lib/mongodb/
    • /var/lib/pgsql/
  • The free disk space in the relevant volume group (VG) is three times the size of the snapshot. More precisely, the VG must have enough space unreserved by the member logical volumes (LVs) to accommodate new snapshots. In addition, one of the LVs must have enough free space for the backup directory.
  • The target backup directory is on a different LV than the directories that you snapshot.

Procedure

  1. Run the satellite-maintain backup script:

    # satellite-maintain backup snapshot /var/backup_directory
  2. Enter y when prompted to start the backup:

    Do you want to proceed?, [y(yes), q(quit)] y

Additional Resources

8.6. Conventional Backup

You can also use the conventional Red Hat Enterprise Linux system backup and recovery methods to backup Satellite or Capsule Server.

Before performing a conventional backup, stop the Satellite services using the satellite-maintain service stop command and restart the services using the satellite-maintain service start command after completion.

For more information, see the System Backup and Recovery section of the Red Hat Enterprise Linux 7 System Administrator’s Guide.

8.7. Backup Data Compression Ratio

The following table lists the data compression ratios of Satellite databases.

Table 8.1. Data and Compression Ratio

Data typeDirectoryRatioExample results

MongoDB database files

/var/lib/mongodb

85 - 90 %

480 GB → 60 GB

PostgreSQL database files

/var/lib/pgsql/data

80 - 85%

100 GB → 20 GB

Pulp RPM files

/var/lib/pulp

(not compressed)

100 GB

Configuration files

/var/lib/qpidd
/var/lib/tftpboot
/etc
/root-ssl/build
/var/www/html/pub
/opt/puppetlabs

85%

942 MB → 141 MB

8.8. Additional Backup Utility Options

The following table describes additional options provided by the satellite-maintain backup utility.

Table 8.2. Additional backup options

Option

Use

Example

--assumeyes

To skip the confirmation prompt.

satellite-maintain backup offline --assumeyes

--whitelist

To skip a labelled step of the backup. To see a list of step labels, run the satellite-maintain advanced procedure run -h command.

satellite-maintain backup offline --whitelist backup-metadata -y /var/backup_directory

--preserve-directory

To provide a custom name for the backup.

satellite-maintain backup offline --preserve-directory /var/backup_directory/ first-backup

8.9. Example Script for Scheduling Offline Backups

Setting up a Full Backup Followed by Daily Incremental Backups

The script performs a full backup on a Sunday and incremental backups of the following days. It creates a new subdirectory for every day that a backup is performed. This script requires a daily cron job.

The satellite-maintain backup script requires that /sbin and /usr/sbin directories are specified in PATH.

#!/bin/bash -e
PATH=/sbin:/bin:/usr/sbin:/usr/bin
DESTINATION=/var/backup_directory
if [[ $(date +%w) == 0 ]]; then
  satellite-maintain backup offline --assumeyes $DESTINATION
else
  LAST=$(ls -td -- $DESTINATION/*/ | head -n 1)
  satellite-maintain backup offline --assumeyes --incremental "$LAST" $DESTINATION
fi
exit 0

8.10. Backup Methods and Types

The following table describes the Satellite backup types and methods.

Table 8.3. Backup Methods and Types

Backup forTypeMethodCommand

Restoring

Full, Incremental

Offline

satellite-maintain backup offline [--incremental]

-

Snapshot

satellite-maintain snapshot

Debugging

Without Pulp Content

Offline

satellite-maintain backup offline --skip-pulp-content

Full, Incremental, Without Pulp Content

Online

satellite-maintain backup online [--incremental][--skip-pulp-content]