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 previous 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.
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:# systemctl stop pulpcore-api pulpcore-content pulpcore-worker\*
Verify whether the services have stopped:
# systemctl status pulpcore-api pulpcore-content pulpcore-worker\*
Back up the following files.
# cp -a <source_files_path> <destination_files_path>
ImportantEnsure 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/*
NoteBacking 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
# rhui-services-restart
12.2. Backing up Red Hat Update Appliance Database
Procedure
Change to the
postgres
user:# su - postgres
Dump the PostgreSQL database:
# pg_dump -j 4 -F d -f <pg_dump_directory> pulp
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.
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.
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:# systemctl stop pulpcore-api pulpcore-content pulpcore-worker\*
Verify whether the services have stopped:
# systemctl status pulpcore-api pulpcore-content pulpcore-worker\*
Restore the following files.
# cp -a <source_files_path> <destination_files_path>
ImportantEnsure 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/*
NoteRestoring 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
# rhui-services-restart
12.4. Restoring Red Hat Update Appliance Database
Procedure
Change to the
postgres
user:# su - postgres
Restore the PostgreSQL database:
# pg_restore -j 4 -F d -d pulp <pg_dump_directory>
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.
The postgres user must be able to read the pg_dump_directory
.
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.
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:# systemctl stop nginx
Verify that the
nginx
service has stopped:# systemctl status nginx
Back up the following files.
# cp -a <source_files_path> <destination_files_path>
ImportantEnsure 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.
# rhui-services-restart
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:# systemctl stop nginx
Verify that the
nginx
service has stopped:# systemctl status nginx
Restore the following files.
# cp -a <source_files_path> <destination_files_path>
ImportantEnsure 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.
# rhui-services-restart
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.# cp -a <source_files_path> <destination_files_path>
ImportantEnsure 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.# cp -a <source_files_path> <destination_files_path>
ImportantEnsure that the file retains its current attributes when you restore it.