How to create high available cluster for HAProxy and Nginx

About VRRP

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.

The protocol achieves this by creation of virtual routers, which are an abstract representation of multiple routers, i.e. master and backup routers, acting as a group. The virtual router is assigned to act as a default gateway of participating hosts, instead of a physical router. If the physical router that is routing packets on behalf of the virtual router fails, another physical router is selected to automatically replace it. The physical router that is forwarding packets at any given time is called the master router.

VRRP provides information on the state of a router, not the routes processed and exchanged by that router. Each VRRP instance is limited, in scope, to a single subnet. It does not advertise IP routes beyond that subnet or affect the routing table in any way. VRRP can be used in Ethernet, MPLS and Token Ring networks with Internet Protocol Version 4 (IPv4), as well as IPv6.

The protocol is described in Internet Engineering Task Force (IETF) publication RFC 5798, which is an open standard, but Cisco claims that a similar protocol with essentially the same facility is patented and licensed; however, in 2001, in reply to a direct request, Robert Barr of Cisco replied that they will not assert any patent claims unless someone tried to assert a claim against Cisco. IBM also claims covering patents and their statement is readable on the IETF webpage.

Go to UP

About HA cluster


HAProxy-WI provides the ability to create HA cluster and add extra VRRP to the cluster via web panel. HAProxy-WI uses Keepalived application for creating VRRP and its own tools for managing HAProxy and Nginx services in cluster mode.

When you have created a HA cluster the keepalived daemon can be used to monitor services or systems and to automatically failover to a standby if problems occur. It will work as on the image:

How to create HA Keepalived cluster with HAProxy-WI

HAProxy-WI will keep configs synced between the master and the slave servers and restart them after editing config or after adding a new sections.

Go to UP

Create VRRP cluster

To create a HA cluster open Keepalived -> HA page. In the "Create new HA cluster" chose the master server and the slave server(in black boxes). After it chose the network interface, press down or start typing and HAProxy-WI will show you existing network interface on the master servers.

Note: The both servers must have the same names of network interfaces. Otherwise you will have to edit Keepalived config for slave manually.

Enter VRRP IP address(in the green box) it will be used as failover address and you should route your traffic to this one.

Note: VRRP IP address must be in the same network as well as the servers.

And at the end press the "Create"(in the red box) button and you will have ready for using HA cluster.

How to create HA Keepalived cluster with HAProxy-WI
Go to UP

Master-Slave relationships

After you have created the HA cluster HAProxy-WI will combine HAProxy and Nginx service as "Master-Slave". If it has not happened go to the Admin area(or Servers if you use groups) -> Servers tab and chose a master server:

How to create HA Keepalived cluster with HAProxy-WI

After this combining HAProxy-WI will update config(and restart/reload, if need) for the slave, when you edited config on the master.

Also HAProxy-WI will keep sync uploaded SSL certificates and black/white lists.

Go to UP