keepalived.conf (5) - Linux Manuals
keepalived.conf: configuration file for keepalived
Command to display keepalived.conf
manual in Linux: $ man 5 keepalived.conf
NAME
/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
global_defs # Block id
{
notification_email # To:
{
admin [at] example1.com
...
}
# From: from address that will be in header
notification_email_from admin [at] example.com
smtp_server 127.0.0.1 # IP
smtp_connect_timeout 30 # integer, seconds
router_id my_hostname # string identifying the machine,
# (doesn't have to be hostname).
vrrp_mcast_group4 224.0.0.18 # optional, default 224.0.0.18
vrrp_mcast_group6 ff02::12 # optional, default ff02::12
enable_traps # enable SNMP traps
}
Static routes/addresses
keepalived can configure static addresses and routes. 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 syntax is the same as for virtual addresses and virtual routes.
static_ipaddress
{
192.168.1.1/24 dev eth0 scope global
...
}
static_routes
{
192.168.2.0/24 via 192.168.1.100 dev eth0
...
}
VRRPD CONFIGURATION
contains subblocks of
VRRP synchronization group(s)
and
VRRP instance(s)
VRRP synchronization group(s)
#string, name of group of IPs that failover together
vrrp_sync_group VG_1 {
group {
inside_network # name of vrrp_instance (below)
outside_network # One for each moveable IP.
...
}
# notify scripts and alerts are optional
#
# filenames of scripts to run on transitions
# can be unquoted (if just filename)
# or quoted (if has parameters)
# to MASTER transition
notify_master /path/to_master.sh
# to BACKUP transition
notify_backup /path/to_backup.sh
# FAULT transition
notify_fault "/path/fault.sh VG_1"
# for ANY state transition.
# "notify" script is called AFTER the
# notify_* script(s) and is executed
# with 3 arguments provided by keepalived
# (ie don't include parameters in the notify line).
# arguments
# $1 = "GROUP"|"INSTANCE"
# $2 = name of group or instance
# $3 = target state of transition
# ("MASTER"|"BACKUP"|"FAULT")
notify /path/notify.sh
# Send email notifcation during state transition,
# using addresses in global_defs above.
smtp_alert
}
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.
#You will need to write another block for outside_network.
vrrp_instance inside_network {
# Initial state, MASTER|BACKUP
# As soon as the other machine(s) come up,
# an election will be held and the machine
# with the highest "priority" will become MASTER.
# So the entry here doesn't matter a whole lot.
state MASTER
# interface for inside_network, bound by vrrp
interface eth0
# Use VRRP Virtual MAC.
use_vmac <VMAC_INTERFACE>