How to create high available cluster for HAProxy, NGINX and Apache
The Virtual Router Redundancy Protocol (VRRP) is a computer networking protocol that provides for automatic assignment of available Internet Protocol (IP) routers to participating hosts. This increases the availability and reliability of routing paths via automatic default gateway selections on an IP subnetwork.
VRRP achieves this by creating virtual routers, which serve as an abstract representation of multiple physical routers, including a master router and backup routers, that work together as a group. The virtual router is designated as the default gateway for participating hosts, rather than relying on a specific physical router. If the physical router currently responsible for routing packets on behalf of the virtual router fails, another physical router is automatically selected to replace it. The physical router that is actively forwarding packets at any given moment is called the master router.
It is important to note that VRRP provides information about the status of routers, rather than the specific routes they process and exchange. Each VRRP instance is limited, in scope, to a single subnet and does not advertise IP routes beyond that subnet or impact the routing table. VRRP is compatible with Ethernet, MPLS, and Token Ring networks, supporting both Internet Protocol Version 4 (IPv4) and IPv6.
Once you have created a HA cluster, the Keepalived daemon can be used to monitor services and systems. In case of failover, the standby router is activated and takes over the routing responsibilities. This process is illustrated in the image below:
Roxy-WI will keep the configurations of the master server and the slave server in sync. When a configuration is edited or new sections are added, the server will be restarted.
If you have already installed Keepalived services and wish to manage them via Roxy-WI, you can either add your existing clusters or create a new one.
To do this, go to the HA cluster section and click Create high availability cluster.
Enter your parameters in the fields provided, including the HA cluster name, the selection of master and slave servers along with their interfaces, and the VIP address.
Click Next and check the boxes for any additional parameters and services. For example, you can use the VIP address as the source for outgoing connections to backends by checking the Use VIP address as source box, or you can add the VRRP address as a separate server by checking the Add VIRT server box.
After this, click Save to save the HA cluster configuration without applying it to the servers, or click Apply to install and configure the HA cluster with the selected services. Your HA cluster will be displayed in the HA cluster section, as shown below:
After creating the HA cluster, Roxy-WI will use HAProxy, NGINX, and Apache services as master and slave. If this has not been set up, go to the Admin area=> Servers section and select a master server:
When two or more servers are combined, the configuration of the slave server will be updated automatically when changes are made to the master server.
Roxy-WI will also keep the uploaded SSL certificates, blacklists, whitelists, and maps synchronized.
The virtual IP serves as the single point of access to the High Availability (HA) cluster and is configured within the Keepalived settings. When a user accesses this virtual IP, the traffic is directed to the appropriate server based on the configured HAProxy policy. With Roxy-WI, you can easily configure the virtual IP through the web interface. To create a virtual IP while setting up the cluster, just check the Add VIRT server box and click Save or Apply. If the process is successful, the new server will be added to the cluster and will be listed as VRRP IP for [Your_server_IP].