Chapter 1. Load Balancer Overview
The Load Balancer is a set of integrated software components that provide for balancing IP traffic across a set of real servers. It consists of two main technologies to monitor cluster members and cluster services: Keepalived and HAProxy. Keepalived uses Linux virtual server (LVS) to perform load balancing and failover tasks on the active and passive routers, while HAProxy performs load balancing and high-availability services to TCP and HTTP applications.
keepaliveddaemon runs on both the active and passive LVS routers. All routers running
keepaliveduse the Virtual Redundancy Routing Protocol (VRRP). The active router sends VRRP advertisements at periodic intervals; if the backup routers fail to receive these advertisements, a new active router is elected.
On the active router,
keepalivedcan also perform load balancing tasks for real servers.
Keepalived is the controlling process related to LVS routers. At boot time, the daemon is started by the
systemctlcommand, which reads the configuration file
/etc/keepalived/keepalived.conf. On the active router, the
keepaliveddaemon starts the LVS service and monitors the health of the services based on the configured topology. Using VRRP, the active router sends periodic advertisements to the backup routers. On the backup routers, the VRRP instance determines the running status of the active router. If the active router fails to advertise after a user-configurable interval, Keepalived initiates failover. During failover, the virtual servers are cleared. The new active router takes control of the virtual IP address (VIP), sends out an ARP message, sets up IPVS table entries (virtual servers), begins health checks, and starts sending VRRP advertisements.
Keepalived performs failover on layer 4, or the Transport layer, upon which TCP conducts connection-based data transmissions. When a real server fails to reply to simple timeout TCP connection,
keepaliveddetects that the server has failed and removes it from the server pool.