keepalived (5) Linux Manual Page
/etc/keepalived/keepalived.conf – configuration file for keepalived
Description
keepalived.conf is the configuration file which describes all the keepalived keywords. keywords are placed in hierachies of blocks (and subblocks), each layer being delimited by ‘{‘ and ‘}’ pairs.
Comments start with ‘#’ or ‘!’ to the end of the line and can start anywhere in a line.
Top Hierachy
GLOBAL CONFIGURATION
VRRPD CONFIGURATION
LVS CONFIGURATION
Global Configuration
contains subblocks of Global definitions and Static routes
Global definitions
Static routes/addresses
keepalived can configure static addresses and routes with ip (ie if addresses are not already on the machine). These addresses are NOT moved by vrrpd, they stay on the machine. If you already have IPs and routes on your machines and your machines can ping each other, you don’t need this section.
The whole string is fed to ip addr add. You can truncate the string anywhere you like and let ip addr add use defaults for the rest of the string. If you just feed the string "192.168.1.1", the IP will be 192.168.1.1/32, which you probably don’t want. This is different to ifconfig which will configure the IP with the standard class, here 192.168.1.1/24. The minimum string then would be the IP/netmask, eg 192.168.1.1/24
The whole string is fed to ip route add. You can truncate the string allowing ip route add to use defaults.
Vrrpd Configuration
contains subblocks of VRRP synchronization group(s) and VRRP instance(s)
VRRP synchronization group(s)
inside_network
outside_network
…
VRRP instance(s)
describes the moveable IP for each instance of a group in vrrp_sync_group. Here are described two IPs (on inside_network and on outside_network), on machine "my_hostname", which belong to the group VG_1 and which will transition together on any state change.
eth0
eth1
…
Lvs Configuration
contains subblocks of Virtual server group(s) and Virtual server(s)
The subblocks contain arguments for ipvsadm(8). A knowlege of ipvsadm(8) will be helpful here.
Virtual server group(s)
Virtual server(s)
A virtual_server can be a declaration of one of
- vip vport (IPADDR PORT pair)
- fwmark <INT>
- (virtual server) group <STRING>
-
#setup service
virtual_server IP port |
virtual_server fwmark int |
virtual_server group string
{
# delay timer for service polling
delay_loop <INT>
# LVS scheduler
lb_algo rr|wrr|lc|wlc|lblc|sh|dh
# LVS forwarding method
lb_kind NAT|DR|TUN
# LVS persistence timeout, sec
persistence_timeout <INT>
# LVS granularity mask (-M in ipvsadm)
persistence_granularity <NETMASK>
# Only TCP is implemented
protocol TCP
# If VS IP address is not set,
# suspend healthchecker’s activity
ha_suspend
# VirtualHost string for HTTP_GET or SSL_GET
# eg virtualhost www.firewall.loc
virtualhost <STRING>
# Assume silently all RSs down and healthchecks
# failed on start. This helps preventing false
# positive actions on startup. Alpha mode is
# disabled by default.
alpha
# On daemon shutdown, consider quorum and RS
# down notifiers for execution, where appropriate.
# Omega mode is disabled by default.
omega
# Minimum total weight of all live servers in
# the pool necessary to operate VS with no
# quality regression. Defaults to 1.
quorum <INT>
# Tolerate this much weight units compared to the
# nominal quorum, when considering quorum gain
# or loss. A flap dampener. Defaults to 0.
hysteresis <INT>
# Script to launch when quorum is gained.
quorum_up <STRING>|<QUOTED-STRING>
# Script to launch when quorum is lost.
quorum_down <STRING>|<QUOTED-STRING>
# setup realserver(s)
# RS to add when all realservers are down
sorry_server <IPADDR> <PORT>
# one entry for each realserver real_server <IPADDR> <PORT>
{
# relative weight to use, default: 1
weight <INT>
# Set weight to 0
# when healthchecker detects failure
inhibit_on_failure
# Script to launch when healthchecker
# considers service as up.
notify_up <STRING>|<QUOTED-STRING>
# Script to launch when healthchecker
# considers service as down.
notify_down <STRING>|<QUOTED-STRING> # pick one healthchecker
# HTTP_GET|SSL_GET|TCP_CHECK|SMTP_CHECK|MISC_CHECK # HTTP and SSL healthcheckers
HTTP_GET|SSL_GET
{
# A url to test
# can have multiple entries here
url {
#eg path / , or path /mrtg2/
path <STRING>
# healthcheck needs status_code
# or status_code and digest
# Digest computed with genhash
