Enabling Health Checks for LB Layer 4

To enable health checks on a real server, you must set the keyword check on each real server line. The keyword must be followed with a line to describe the check to perform.

The ALOHA load balancer can perform the following checks when running in L4 load-balancing mode:

ARP Check

To check a real server's availability using an arp whohas packet, use the following directive:

option arpcheck [interval <seconds>] [timeout <seconds>] [source <ip>] [iface <name>]

This directive takes the following arguments:

interval <seconds> (optional)

Interval between two checks, in seconds (default: 10 seconds)

timeout <seconds> (optional)

Period after which an attempt without a response from the server is considered as failed (default: 3 seconds)

source <ip> (optional)

Source IP to use when performing the check

iface <name> (optional)

Network interface name to use when sending the ARP packet

Check the availability of an NFS server:

director d_nfs
  [...]
  option arpcheck interval 4s timeout 1s``
  server nfs1 10.0.0.1 check
  server nfs2 10.0.0.2 check

ICMP Check

This check looks at a real server's availability using an icmp echo request packet as follows:

option icmp check [interval <seconds>] [timeout <seconds>] [source <ip>]

This directive takes the following arguments:

interval <seconds> (optional)

Interval between two checks, in seconds (default: 10 seconds)

timeout <seconds> (optional)

Period after which an attempt without a response from the server is considered as failed (default: 3 seconds)

source <ip> (optional)

Source IP to use when performing the check

Check the availability of a NFS server

director d_nfs
  [...]
  option icmpcheck interval 4s timeout 1s
  server nfs1 10.0.0.1 check
  server nfs2 10.0.0.2 check

TCP Handshake

To check a real server's availability by running a TCP handshake, use the following directive:

option tcpcheck [interval <seconds>] [timeout <seconds>] [source <ip>] [port <port>]

This directive takes the following arguments:

interval <seconds> (optional)

Interval between two checks, in seconds (default: 10 seconds)

timeout <seconds> (optional)

Period after which an attempt without a response from the server is considered as failed (default: 3 seconds)

source <ip> (optional)

Source IP to use when performing the check

port <port> (optional)

Forces the destination port (default: real server port, if it exists)

Check the availability of an FTP server

director d_ftp
  [...]
  option tcpcheck port 21 interval 5s timeout 1s
  server ftp1 10.0.0.1 check
  server ftp2 10.0.0.2 check

HTTP Check

To check a real server's availability by running a GET HTTP request, use the following directive:

option httpcheck [interval <seconds>] [timeout <seconds>] [source <ip>] [port <port>] [uri <uri>] [statuscode <code>]

This directive takes the following arguments:

interval <seconds> (optional)

Interval between two checks, in seconds (default: 10 seconds)

timeout <seconds> (optional)

Period after which an attempt without a response from the server is considered as failed (default: 3 seconds)

source <ip> (optional)

Source IP to use when performing the check

port <port> (optional)

Forces the destination port (default: real server port, if it exists)

uri <string> (optional)

URI requested (default: the root /)

vhost <string> (optional)

Virtual Host to test (otherwise, the real server IP is used)

statuscode <code> (optional)

Expected status code (default: code 200)

Check the availability of an HTTP application hosted on app.domain.com server:

director d_http
  [...]
  option httpcheck port 80 uri /check vhost app.domain.com interval 5s timeout 1s
  server web1 10.0.0.1:443 check
  server web2 10.0.0.2:443 check