Cloudmin's DNS roundrobins feature allows you to create and manage DNS entries that are automatically updated to resolve to the IP addresses of multiple systems, selected based on their health or other criteria. These can be used to balance web traffic between several servers, while automatically removing those systems that have failed. They can be used with both physical systems managed by Cloudmin, or virtual machines.
As of Cloudmin version 5.9, this feature also supports the automatic configuration of a proxy balancer like Apache or Nginx to forward web requests to backend systems based on their availability. This has the advantage over DNS-based balancing that updates are immediate from the point of view of web clients. See the Proxy Balancing section below for more details.
In order to automatically update a DNS record, its zone must be hosted on the Cloudmin master system. When Cloudmin is used to manage virtual systems the master machine is typically already setup as a DNS server, so that records can be created for virtual machines.
If you typically host DNS zones on a separate system, it could be setup as DNS slave for the zone that will contain the dynamically update record, with the Cloudmin system as the master. Only the slave would need to be registered, and so would receive all queries from outside users. If BIND record change notification is enabled, this will not lead to any significant increase in update latency.
Another alternative is to use the new Cloudmin Services product, which allows a master system to manage remotely hosted DNS zones, among other features. The DNS roundrobin feature is also capable of updating any zone created using the provisioning service.
Creating a DNS Roundrobin
The steps to create a new roundrobin are :
- Login to Cloudmin as
root, and go to System Monitoring -> Roundrobin DNS Records.
- Click the Add a new DNS roundrobin link.
- In the Systems to include section, you can either select specific hosts, or choose systems by group membership or owner. Make sure that all the selected systems can provide the same service, such as a specific website. Once they are included in the roundrobin, clients may send requests to any of the chosen systems. The Systems with IP addresses field can be used to enter arbitrary IPs to include in the roundrobin, even addresses for systems that are not managed by Cloudmin.
- In the Record name field, enter the name of the DNS record that will be created and updated. It will be in the DNS domain selected from the DNS zone menu.
- The time that clients will cache the DNS record can be set in the DNS cache time field. Something like 300 seconds (5 minutes) is a reasonable tradeoff between the higher load caused by a lower TTL, and the increased time before a failed system is no longer used by clients.
- In the **Conditions for systems to include* section, you can control which of the selected systems are actually used in the DNS record. Selection can be based on their status as determined by Cloudmin's monitoring, open ports, or accessibility of some URL. All conditions must be satisfied for a system to be used.
- If you want to receive email notification if the number of systems drops too low, enter a threshold in the Send email if usable systems is below field.
- Click the Create button. The DNS record will be created immediately.
Editing DNS Roundrobins
Once a record has been created, you can view its status and change settings on the DNS Roundrobins page. A record can be edited by clicking on the hostname, or removed with the Delete Selected Roundrobins button. Cloudmin's background status monitoring will update DNS records every 5 minutes by default, but you can force an immediate refresh with the Refresh Roundrobins button.
To see exactly which systems were or were not include in a record, click on its domain name and then open the Status from check section on the Edit DNS Roundrobin page. This will list all systems that could be included, and the reason why not if any were left out.
DNS Record Limits
By default Cloudmin will create a DNS A record for the IP address of each usable system that it finds. However, you can limited the number of addresses with the Address records to include field. This can be useful if setting up failover between a master and backup systems - in that case, you would set it to
1. Systems are tried in the order they are selected in the Systems to include section.
If you have a system running Virtualmin that is under Cloudmin's control, a domain on that system can be used as a proxy for multiple backend webservers. This method is superior to DNS-based roundrobin load balancing, as changes do not need to propagate out to DNS clients. However, it requires that an additional system be used as a web load balancer, which will forward all requests on to active backend serving systems.
To setup a proxy balancer, create or edit an DNS roundrobin as explained above. Then do the following :
- Open the Proxy balancer configuration section, and select the system that will act as a proxy from the System to update proxy on list.
- In the Domain to create proxy in field, enter a Virtualmin domain that is hosted on the selected system, like
- In almost all cases, the URL path and Destination HTTP port fields can be left un-changed, unless you only want to proxy a sub-directory or are running the backend webservers on a different port.
- Click the Save or Create button.
After every system status update, Cloudmin will then create or modify a web proxy balancer in the specified domain to forward HTTP requests to the systems that match the conditions for inclusion in the DNS record.
When a proxy like this in use, the DNS roundrobin record may no longer be needed at all, as clients will access the backend webservers via the domain name that you entered. The DNS record must still be defined though, and will still be maintained by Cloudmin.
When a DNS roundrobin that uses a proxy balancer is deleted, the proxy will be deleted from the Virtualmin system as well.