Chapter 12. Backing up and restoring Red Hat Update Infrastructure After you have installed and configured your Red Hat Update Infrastructure(RHUI) servers, you might want to back them up. Backing up RHUI is useful if you encounter any problems or do not configure RHUI correctly. In such cases, you can return to a working configuration by restoring RHUI. To successfully back up RHUI, you must back up all of your RHUA, CDS, and HAProxy nodes. 12.1. Backing up Red Hat Update Appliance To back up Red Hat Update Appliance, you must back up all the associated files and storage. Note To back up RHUA, you must stop the associated services. However, stopping services does not disable any client instances from updating or installing packages because clients are connected only to the content delivery servers (CDSs). Consequently, If you have an automated monitoring solution in place, your monitoring may fail during the backup process. Procedure Stop pulp-server services: Verify whether the services have stopped: Back up the following files. Important Ensure that the files retain their current attributes when you back them up. List of Files: /etc/pki/rhui/* /etc/pulp/* /etc/rhui/* /etc/rhui/rhui-tools.conf /etc/nginx/* /root/.rhui/* /var/log/rhui/* /var/log/rhui-subscription-sync.log* Optional: /var/lib/rhui/* Note Backing up this directory backs up all of the downloaded content, which might be a large amount of data. Back up any generated client entitlement certificates and client configuration RPMs. Restart RHUI services 12.2. Backing up Red Hat Update Appliance Database Procedure Change to the postgres user: Dump the PostgreSQL database: Note The arguments used with the pg_dump command are as follows: -j 4 : Instructs pg_dump to run using 4 parallel threads. -F d : Instructs pg_dump to select a directory-format archive as the format of the output. <pg_dump_directory> : The path the directory where pg_dump output will be written. pulp : Is the name of the database. Important The postgres user must be able to create and write to the pg_dump_directory and there must be enough disk space. For reference, the dump of a very large database configured with about 600 repositories takes approximately 25 GB. Important This operation can take a lot of time. For reference, our example of the database with 600 repositores could take up to 5 hours. 12.3. Restoring Red Hat Update Appliance To restore RHUA, you must create a new RHUA node and replace the associated files with the backed up versions. Procedure Create a new RHUA node. For more information, see Setting up RHUA nodes . Stop pulp-server services: Verify whether the services have stopped: Restore the following files. Important Ensure that the files retain their current attributes when you restore them. List of Files: /etc/pki/rhui/* /etc/pulp/* /etc/rhui/* /etc/rhui/rhui-tools.conf /etc/nginx/* /root/.rhui/* /var/log/rhui/* /var/log/rhui-subscription-sync.log* Optional: /var/lib/rhui/* Note Restoring this directory restores all of the downloaded content, which might be a large amount of data. Restore any generated client entitlement certificates and client configuration RPMs. Restart RHUI services 12.4. Restoring Red Hat Update Appliance Database Procedure Change to the postgres user: Restore the PostgreSQL database: Note The arguments used with the pg_restore command are as follows: -j 4 : Instructs pg_restore to run using 4 parallel threads. -F d : Instructs pg_restore to select a directory-format archive as the format of the input. -d pulp : Instructs pg_restore to use the database names pulp . <pg_dump_directory> : The path the directory where pg_dump output will be read from. Important The postgres user must be able to read the pg_dump_directory . Important This operation can take a lot of time. For reference, our example of the database with 600 repositores could take up to 5 hours. 12.5. Backing up content delivery servers To back up CDSs, you must back up all the associated files and storage. Note To avoid complete loss of service, back up a single CDS node at a time. Clients will automatically switch to other running CDS nodes. Procedure Stop the nginx service: Verify that the nginx service has stopped: Back up the following files. Important Ensure that the files retain their current attributes when you back them up. List of files: /etc/nginx/* /var/log/nginx/* /etc/pki/rhui/* Restart RHUI services. 12.6. Restoring content delivery servers To restore content delivery servers, you must create a new CDS node and replace the associated files with the backed up versions. Procedure Create a new CDS node. For more information, see Setting up CDS nodes . Stop the nginx service: Verify that the nginx service has stopped: Restore the following files. Important Ensure that the files retain their current attributes when you restore them. List of files: /etc/nginx/* /var/log/nginx/* /etc/pki/rhui/* Restart RHUI services. 12.7. Backing up HAProxy servers To back up HAProxy servers, you must back up all the associated files and storage. Procedure Back up the /etc/haproxy/haproxy.cfg file. Important Ensure that the file retains its current attributes when you back it up. 12.8. Restoring HAProxy servers To restore HAProxy servers, you must create a new HAProxy node and replace the associated files with the backed up versions. Procedure Create a new HAProxy node. For more information, see Setting up HAProxy nodes . Restore the /etc/haproxy/haproxy.cfg file. Important Ensure that the file retains its current attributes when you restore it.

Commands:
systemctl stop pulpcore-api pulpcore-content pulpcore-worker\ *
systemctl status pulpcore-api pulpcore-content pulpcore-worker\ *
cp -a <source_files_path> <destination_files_path>
rhui-services-restart
su - postgres
pg_dump -j 4 -F d -f <pg_dump_directory> pulp
systemctl stop pulpcore-api pulpcore-content pulpcore-worker\ *
systemctl status pulpcore-api pulpcore-content pulpcore-worker\ *
cp -a <source_files_path> <destination_files_path>
rhui-services-restart
su - postgres
pg_restore -j 4 -F d -d pulp <pg_dump_directory>
systemctl stop nginx
systemctl status nginx
cp -a <source_files_path> <destination_files_path>
rhui-services-restart
systemctl stop nginx
systemctl status nginx
cp -a <source_files_path> <destination_files_path>
rhui-services-restart
cp -a <source_files_path> <destination_files_path>
cp -a <source_files_path> <destination_files_path>