Tags Archives: keepalived

LPIC3 DIPLOMA Linux Clustering – LAB NOTES: Lesson – Overview of HA Load-Balancing Solutions

LPIC3 Overview of Load Balancing (LB) Solutions

 

 

LBs generally involve traffic for a front-end IP address being forwarded to another server IP in the backend.  Netfilter functionality is used, thus ip_forwarding has to be enabled on the frontend server/s. Often load balancing is used together with High-Availability clustering such as Pacemaker.

 

 

There are 5 load-balancing systems we are going to mention here:

 

DNS Round-Robin: the simplest solution, has no monitoring.

 

LVS Linux Virtual Server: is built into the Linux kernel.

 

HAProxy: a high-level LB which works at OSI layers 4 and 7 respectively.

 

Keepalived: uses VRRP to monitor availability of IP addressess

 

Ldirectord: obsolete legacy LB which was often used together with Heartbeat and LVS. Not generally implemented in new systems nowadays.

 

 

 

 

DNS Round Robin Load Balancing

 

Round-robin DNS is a “flat”, non-hierarchical and simple load-balancing mechanism which makes use of multiple DNS A records to map multiple servers to a single host name and then sends requests to each server in turn.

 

It is not true “load” balancing since it does not actually measure loads and does no health checks. Thus if one server goes down, traffic will still be send to that server IP.

 

Its main advantage is its simplicity of implementation and operation.

 

example config:

 

webserver.example.com. IN A 172.16.10.20
webserver.example.com. IN A 172.16.10.21
webserver.example.com. IN A 172.16.10.22

 

 

LVS Load Balancing

 

LVS also provides for High Availability but it can also provide load balancing functionality.

 

Configured using ipvsadm on command line.

 

eg

 

ipvsadm -A -t 192.168.0.1:80 -s rr

 

ipvsadm -a -t 192.168.0.1:80 -r 172.16.0.1:80 -m

 

ipvsadm -a -t 192.168.0.1:80 -r 172.16.0.2:80 -m

 

verify with ipvsadm -L -n

 

 

HAProxy Load Balancing

 

– see separate page about this for more detail. Here just a very brief overview.

 

 

Supports SSL, Suppression, Keepalive, custom logging and extensive stats facility. Also has a Pacemaker resource agent to allow for integration into Pacemaker cluster.

 

Can run in TCP mode Layer 4 – forwards raw TCP packets from client to application servers

 

Can also run in HTTP Mode Layer 7: this is the most common mode for using HAProxy.

 

HAProxy offers following LB algorithms:

 

Roundrobin: each new connection handled in turn by each backend server.

 

Lastconn: each new connection is handled by the backend server with the current least number of connections.

 

Source: the same backend server is used for a session to guarantee that no data is lost, eg in the case of shopping carts (where “persistence” is required for the data).

 

 

Config is done via haproxy.conf in /etc/haproxy.

 

 

Keepalived

 

A network-oriented solution that ensures a shared IP is always present.

 

uses VRRP Virtual Router Redundancy Protocol

 

But does not guarantee service availability, just IP address availability.

 

Commonly used to configure redundant routers, firewalls and proxies, but not used for anything that requires “stateful” connections.

 

Ldirectord

 

Ldirectord is a “legacy” LB which tends no longer to be found in current newly built environments.

 

It tended to be used together with Pacemaker or Heartbeat HA. Most sites nowadays will use keepalived or HAProxy as these provide much better functionality.

 

 

 

 

 

Continue Reading