ucarp overview
ucarp is a method for a machine to use vrrp to 'advertise' that it 'owns' a particular IP address. Each machine sends out a vrrp message advertising that it can have that IP every X seconds. This is the 'advbase' (advertising base). Each machine sends a skew value with that vrrp message which is akin to its priority of holding that IP. This is the 'advskew' (advertising skew). Two machines both advertising at 1-second intervals (advbase=1), the one with the lower advskew will 'win'.
- backup will become master if:
- no one else advertises for 3 times its own advertisement interval (advbase)
- you specified --preempt and it hears a master with a longer (advertisement) interval (or the same advbase but a higher advskew)
- master will become backup if:
- another master advertises a shorter interval (or the same advbase but a lower advskew)
- another master advertises the same interval, and has a lower IP address
Signals
Sending a SIGUSR1 to the carp process will log to syslog the status of carp.
Sending a SIGUSR2 to the carp process will attempt to demote the machine you're on if it is master
Install/configure
sub: May also be in /etc/sysconfig/carp/ now-adays
yum install ucarp cd /etc/ucarp/ cp vip-common.conf vip-common.dist
vim vip-common.conf
# Common VIP settings which can be overridden in individual vip-.conf # If you have extra options to add, see "ucarp --help" output BIND_INTERFACE="eth0" SOURCE_ADDRESS="10.1.80.181" # non-shared IP PASSWORD="PASSWORD" OPTIONS="--advskew 50 --shutdown --preempt"
vim /etc/ucarp/vip-001.conf
ID="001" VIP_ADDRESS="10.1.80.180" # shared IP
The only differences between the primary machine's configurations and the secondary's are:
- advskew will be lower (numerically) on the primary.
- SOURCE_ADDRESS will be each machine's unique (always-theirs) IP.
chkconfig ucarp on service ucarp start
To confirm things are working as expected - turn off the networking on the primary machine and verify that the secondary 'picks up':
tcpdump vrrp
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on eth0, link-type EN10MB (Ethernet), capture size 96 bytes 74:58:33.312636 IP carptest.example.com > vrrp.mcast.net: VRRPv2, Advertisement, vrid 1, prio 50, authtype none, intvl 1s, length 36 74:58:34.505079 IP carptest.example.com > vrrp.mcast.net: VRRPv2, Advertisement, vrid 1, prio 50, authtype none, intvl 1s, length 36 74:58:35.700066 IP carptest.example.com > vrrp.mcast.net: VRRPv2, Advertisement, vrid 1, prio 50, authtype none, intvl 1s, length 36 74:58:36.895059 IP carptest.example.com > vrrp.mcast.net: VRRPv2, Advertisement, vrid 1, prio 50, authtype none, intvl 1s, length 36 74:58:38.090053 IP carptest.example.com > vrrp.mcast.net: VRRPv2, Advertisement, vrid 1, prio 50, authtype none, intvl 1s, length 36 74:58:39.285049 IP carptest.example.com > vrrp.mcast.net: VRRPv2, Advertisement, vrid 1, prio 50, authtype none, intvl 1s, length 36