Keepalived can do this by combining the nopreempt option and the BACKUP state on the both nodes:

How about the UCARP?

Name       : ucarp
Arch       : x86_64
Version    : 1.5.2
Release    : 1.el5.rf
Size       : 81 k
Repo       : installed
Summary    : Common Address Redundancy Protocol (CARP) for Unix
URL        : http://www.ucarp.org/
License    : BSD
Description: UCARP allows a couple of hosts to share common virtual IP addresses in order
           : to provide automatic failover. It is a portable userland implementation of the
           : secure and patent-free Common Address Redundancy Protocol (CARP, OpenBSD's
           : alternative to the patents-bloated VRRP).
           : Strong points of the CARP protocol are: very low overhead, cryptographically
           : signed messages, interoperability between different operating systems and no
           : need for any dedicated extra network link between redundant hosts.

If I don't use the --preempt option and set the --advskew to the same value, both nodes become master.


# Virtual IP configuration file for UCARP
# The number (from 001 to 255) in the name of the file is the identifier
# $Id: vip-001.conf.example 1527 2004-07-09 15:23:54Z dude $

# Set the same password on all mamchines sharing the same virtual IP

# You are required to have an IPADDR= line in the configuration file for
# this interface (so no DHCP allowed)

# Do *NOT* use a main interface for the virtual IP, use an ethX:Y alias
# with the corresponding /etc/sysconfig/network-scripts/ifcfg-ethX:Y file
# already configured and ith ONBOOT=no

# If you have extra options to add, see "ucarp --help" output
# (the lower the "-k <val>" the higher priority and "-P" to become master ASAP)
OPTIONS="-z -k 255"



node 1:

eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
    link/ether c6:9b:8e:af:a7:69 brd ff:ff:ff:ff:ff:ff
    inet brd scope global eth0
    inet brd scope global secondary eth0:0
    inet6 fe80::c49b:8eff:feaf:a769/64 scope link 
       valid_lft forever preferred_lft forever

node 2:

eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
    link/ether 00:30:48:f7:0f:81 brd ff:ff:ff:ff:ff:ff
    inet brd scope global eth1
    inet brd scope global secondary eth1:0
    inet6 fe80::230:48ff:fef7:f81/64 scope link 
       valid_lft forever preferred_lft forever

For UCARP, I think the trick is to start it in "neutral" mode using the --neutral flag, so that it doesn't automatically assume the master role or try anything upon start. Looking at one of my setups, here's the full command line. Perhaps --neutral applies because we have upscripts and downscripts applied at startup and shutdown, but it's worth a try.

/path/to/ucarp0 -v 42 -p kitteh0 --interface=bond0 -a -s -b 5 -r 3 --upscript=/path/to/ucarp/upscript0 --downscript=/path/to/ucarp/downscript0 --neutral -z -B

  • I also paid attention to this flag but I think it has different meaning: the --neutral (-n) switch causes ucarp to not run the downscript when it changes from the INIT state to the BACKUP state. Is the second server started with the same options as the first server? I've tried OPTIONS="-b 3 -r 5 -n -z", but nothing changes: both server become the master. If I started the second server with advertisement frequency (-b) greater than the first one, the VIP fail back to the original master. – quanta Oct 18 '12 at 14:57
  • Hmm... That's how it was explained to me here. I'll ask around. – ewwhite Oct 18 '12 at 17:15

I don't see the ucarp clusters (which i inherited) ever switching back by themselves.

They are indeed set to preempt=no.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.