Chapter 18. Backup and Disaster Recovery
18.1. Backing up Red Hat Satellite Copiar enlaceEnlace copiado en el portapapeles!
/backup
directory as the target directory for backup archives, and is described in several parts:
- Preparing the backup location and backing up configuration and data files
- Backing up the repositories
- Backing up the databases
- Verifying the backup
Note
enforcing
mode, ensure that any local content requiring synchronization is labeled with "httpd_sys_content_t".
Procedure 18.1. To Prepare the Backup Location and Back up Configuration and Data Files:
- Prepare your backup location:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Back up the configuration and data files:
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
The RPM files in repositories already use compression and cannot be compressed any further. Therefore, depending on instance size, the resulting backup archive (pulp_data.tar
) can grow quite large. Ensure you have sufficient space to store the resulting file.
Procedure 18.2. To Perform an Online Repository Backup:
- Run the following commands to perform a checksum of all time stamps, back up the repository, and perform the checksum again.
find /var/lib/pulp -printf '%T@\n' | md5sum tar --selinux -cvf pulp_data.tar /var/lib/pulp /var/www/pub find /var/lib/pulp -printf '%T@\n' | md5sum
# find /var/lib/pulp -printf '%T@\n' | md5sum # tar --selinux -cvf pulp_data.tar /var/lib/pulp /var/www/pub # find /var/lib/pulp -printf '%T@\n' | md5sum
Copy to Clipboard Copied! Toggle word wrap Toggle overflow If the checksums match, the online backup is correct and usable. If the checksums do not match, perform the repository backup again.Note
You can use thersync
command to speed up file copying. This can help to ensure the checksums match.
Procedure 18.3. To Perform an Offline Repository Backup:
- Run the following commands to stop the required services, perform the backup, and restart the services:
katello-service stop tar --selinux -cvf pulp_data.tar /var/lib/pulp /var/www/pub katello-service start
# katello-service stop # tar --selinux -cvf pulp_data.tar /var/lib/pulp /var/www/pub # katello-service start
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Note
While thekatello-service
is stopped, Red Hat Satellite and the yum clients will be unable to maintain a connection. Any repository actions performed on Red Hat Satellite will fail during this period.
You can perform either online or offline database backups. You do not need to do both. Offline backups require that the Satellite Server be completely inactive.
Warning
Procedure 18.4. To Perform a Complete Offline Database Backup:
- Ensure the Satellite Server is completely stopped:
katello-service stop
# katello-service stop
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Run the following commands to back up the PostgreSQL and MongoDB databases:
tar --selinux -czvf mongo_data.tar.gz /var/lib/mongodb tar --selinux -czvf pgsql_data.tar.gz /var/lib/pgsql/data/
# tar --selinux -czvf mongo_data.tar.gz /var/lib/mongodb # tar --selinux -czvf pgsql_data.tar.gz /var/lib/pgsql/data/
Copy to Clipboard Copied! Toggle word wrap Toggle overflow - Restart the required services:
katello-service start
# katello-service start
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
If you prefer, you can perform separate online backups of your databases. This is not necessary if you have performed complete offline backups.
Procedure 18.5. To Perform an Online Backup of the PostgreSQL Database:
- 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 ofdb_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 theanswers.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. - Run the following commands to create online database backups. It is not necessary to stop PostgreSQL or Red Hat Satellite, and this process does not block logged-in users. However, the process can take several minutes to finish depending on database sizes.
runuser - postgres -c "pg_dump -Fc foreman > /backup/foreman.dump" runuser - postgres -c "pg_dump -Fc candlepin > /backup/candlepin.dump"
# runuser - postgres -c "pg_dump -Fc foreman > /backup/foreman.dump" # runuser - postgres -c "pg_dump -Fc candlepin > /backup/candlepin.dump"
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Procedure 18.6. To Perform an Online Backup of the MongoDB Database:
- Run the following command in the
/backup
directory to create the/backup/mongo_dump/pulp_database
directory, including JSON files.mongodump --host localhost --out $BDIR/mongo_dump
# mongodump --host localhost --out $BDIR/mongo_dump
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
It is important to verify the results of your backups. The process creates the following archive files and directory:
mongo_data.tar.gz pgsql_data.tar.gz
mongo_data.tar.gz
pgsql_data.tar.gz