Chapter 7. Managing an HAProxy load-balancer instance
A load-balancing solution must be in place to spread client HTTPS requests across all CDS servers. Red Hat Update Infrastructure 4 uses HAProxy by default, but it is up to you to choose what load-balancing solution (for example, the one from the cloud provider) to use during the installation. If HAProxy is used, you must also decide how many nodes to bring in.
7.1. Registering a new HAProxy load-balancer Copy linkLink copied to clipboard!
Red Hat Update Infrastructure 4 uses DNS to reach the CDN. In most cases, your instance should be preconfigured to talk to the proper DNS servers hosted as part of the cloud’s infrastructure. If you run your own DNS servers or update your client DNS configuration, there is a chance you will see errors similar to yum Could not contact any CDS load balancers. In these cases, check that your DNS server is forwarding to the cloud’s DNS servers for the request or that your DNS client is configured to fall back to the cloud’s DNS server for name resolution.
Using more than one HAProxy node requires a round-robin DNS entry for the hostname used as the value of the --cds-lb-hostname parameter when rhui-installer is run (cds.example.com in this guide) that resolves to the IP addresses of all HAProxy nodes. How to Configure DNS Round Robin presents one way to configure a round-robin DNS. In the context of Red Hat Update Infrastructure 4, these will be the IP addresses of the HAProxy nodes, and they are to be mapped to the hostname specified as --cds-lb-hostname while calling rhui-installer.
Answering yes (y) to the below question: Update instance(s) after reinstalling? (y/n): will result in a dnf update being run on the instance after it is registered. This may require a reboot of the instance. Answering no (n) to this question will result in the dnf update not being run.
Prerequisites
-
Make sure
sshdis running on the HAProxy load-balancer node and thatport 443is open.
Procedure
Navigate to the Red Hat Update Infrastructure Management Tool home screen:
rhui-manager
[root@rhua ~]# rhui-managerCopy to Clipboard Copied! Toggle word wrap Toggle overflow -
Press
lto select manage HAProxy load-balancer instances. -
From the Load-balancer (HAProxy) Management screen, press
ato add a new load-balancer instance. Enter the hostname of the new load-balancer:
Hostname of the HAProxy Load-balancer instance to register: <haproxy1.example.com>
Hostname of the HAProxy Load-balancer instance to register: <haproxy1.example.com>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Enter the username that will have SSH access to the load-balancer and have sudo privileges:
Username with SSH access to cds.example.com and sudo privileges: <cloud-user>
Username with SSH access to cds.example.com and sudo privileges: <cloud-user>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Enter the absolute path to the SSH private key for logging in to the load-balancer instance and press
Enter:Absolute path to an SSH private key to log into cds.example.com as <cloud-user>: /<cloud-user>/.ssh/id_rsa_rhua
Absolute path to an SSH private key to log into cds.example.com as <cloud-user>: /<cloud-user>/.ssh/id_rsa_rhuaCopy to Clipboard Copied! Toggle word wrap Toggle overflow Update the instance with the latest versions of available packages
Update instance after registering? (y/n): y
Update instance after registering? (y/n): yCopy to Clipboard Copied! Toggle word wrap Toggle overflow Optional: Enter an optional absolute path to a user supplied HAProxy configuration file and press
Enter.If you do not specify the path to a custom configuration file, the default file,
/usr/share/rhui-tools/templates/haproxy.cfg, is used instead.Copy to Clipboard Copied! Toggle word wrap Toggle overflow - If the load-balancer fails to add, check that the firewall rules permit access between the RHUA and the load-balancer.
- After successful configuration, repeat these steps for any remaining load-balancer instances.
Verification
The following message displays:
The HAProxy Load-balancer was successfully configured.
The HAProxy Load-balancer was successfully configured.Copy to Clipboard Copied! Toggle word wrap Toggle overflow
7.2. Listing all known HAProxy load-balancer instances managed by RHUI 4 Copy linkLink copied to clipboard!
You can use Load-balancer (HAProxy) Management screen to show all known HAProxy load-balancer instances that RHUI 4 is managing.
Procedure
Navigate to the Red Hat Update Infrastructure Management Tool home screen:
rhui-manager
[root@rhua ~]# rhui-managerCopy to Clipboard Copied! Toggle word wrap Toggle overflow -
Press
lto select manage HAProxy load-balancer instances. From the Load-balancer (HAProxy) Management screen, press
lto list the load-balancer instances that RHUI manages:Hostname: <haproxy1.example.com> SSH Username: <cloud-user> SSH Private Key: /<cloud-user>/.ssh/id_rsa_rhua
Hostname: <haproxy1.example.com> SSH Username: <cloud-user> SSH Private Key: /<cloud-user>/.ssh/id_rsa_rhuaCopy to Clipboard Copied! Toggle word wrap Toggle overflow
7.3. Reinstalling and reapplying the configuration to an HAProxy load-balancer Copy linkLink copied to clipboard!
You may encounter a situation where you need to reinstall and reapply the configuration for an HAProxy load-balancer. The Red Hat Update Infrastructure Management Tool provides an easy way to accomplish this task.
Prerequisites
-
Make sure
sshdis running on the HAProxy load-balancer node and thatport 443is open.
It is crucial that the files included in the restore retain their current attributes.
Answering yes (y) to the below question: Update instance(s) after reinstalling? (y/n): will result in a dnf update being run on the instance after it is reinstalled. This may require a reboot of the instance. Answering no (n) to this question will result in the dnf update not being run.
Procedure
Navigate to the Red Hat Update Infrastructure Management Tool home screen:
rhui-manager
[root@rhua ~]# rhui-managerCopy to Clipboard Copied! Toggle word wrap Toggle overflow -
Press
lto select manage HAProxy load-balancer instances. From the Load-balancer (HAProxy) Management screen, press
rto reinstall and reapply the configuration to a load-balancer instance.The Red Hat Update Infrastructure Management Tool automatically performs all reinstallation and reconfiguration tasks.
Select the load-balancer to reinstall:
1 - Hostname: <haproxy1.example.com> SSH Username: <cloud-user> SSH Private Key: /<cloud-user>/.ssh/id_rsa_rhua1 - Hostname: <haproxy1.example.com> SSH Username: <cloud-user> SSH Private Key: /<cloud-user>/.ssh/id_rsa_rhuaCopy to Clipboard Copied! Toggle word wrap Toggle overflow -
Enter a value or
bto abort: 1: 1 Update instance(s) after reinstalling? (y/n): y
Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
Check that you successfully reinstalled and reconfigured the load-balancer by viewing the code output:
Ensuring that HAProxy is available... Done.
Ensuring that HAProxy is available... Done.Copy to Clipboard Copied! Toggle word wrap Toggle overflow
7.4. Unregistering an HAProxy load-balancer Copy linkLink copied to clipboard!
You can unregister (delete) an HAProxy load-balancer instance that you are not going to use.
Prerequisites
-
Make sure
sshdis running on the HAProxy load-balancer node and thatport 443is open.
Procedure
Navigate to the Red Hat Update Infrastructure Management Tool home screen:
rhui-manager
[root@rhua ~]# rhui-managerCopy to Clipboard Copied! Toggle word wrap Toggle overflow -
Press
lto select manage HAProxy load-balancer instances. -
From the Load-balancer (HAProxy) Management screen, press
dto delete a load-balancer instance. Enter the hostname of the load-balancer to delete:
Hostname of the load-balancer instance to unregister: <haproxy1.example.com>
Hostname of the load-balancer instance to unregister: <haproxy1.example.com>Copy to Clipboard Copied! Toggle word wrap Toggle overflow