Can anyone explain what is the major difference between Heartbeat and UCarp for IP fail-over scenarios?

They both seem to provide this functionality, perhaps UCarp simpler to set-up?



1 Answer 1


i assume you're interested in simple active-passive setup.

ucarp & heartbeat in such setup do pretty much the same thing. in essence - they run provided scripts when machine is elected to be master / hot-standby.

heartbeat might look much more complicated [ since it can help you autoamte drdb mounts, restarting multiple services etc ] but at the end - you can script all of this and let ucarp invoke it].

personally - i run heartbeat with single resource - that is script that does following:

  • [un]binds appropriate ip address
  • runs couple of arp-broadcasts
  • starts[stops] required services

my very simplistic setup [ heartbeat 2.1.3-6 under debian lenny ]: i have two servers:

  • ser0 [preferred active node] with permanently assigned at eth0
  • ser0b [hot-standby node waiting to replace master] with permanently assigned at eth0

'floating ip' - assigned to the active node is assigned to eth1

in this case service that gets high availability is apache. i separately sync apache's configs and content that is served from ser0 to ser0b.

files below are identical on both machines with one marked exception:


auth 1
1 md5 somethingrandom


ser0 ha.sh


keepalive 2
deadtime 10
udpport        694 
; below - address permanently assigned to the peer node . this is for master:
ucast eth1
; and on slave i have 
; ucast eth1
udp     eth0
logfacility     local0
auto_failback on

node    ser0
node    ser0b

/etc/init.d/ha.cf [ it can as well be in /etc/ha.d/resources.d/ha.cf ]

case "$1" in
        ip link set dev eth1 up
        # bind 'floating' ip to the interface
        ip a a dev eth1
        # you might want to add some route-changes here if needed
        /usr/lib/heartbeat/send_arp -r 10 eth1 auto
        # to make sure apache reloads it's config when machine becomes master
        /etc/init.d/apache2 restart

        # we are no longer active, un-bind 'floating' ip from the interface
        ip a d dev eth1
        # you could stop it as well or just skip this step
        /etc/init.d/apache2 restart
exit 0
  • Hi. Thanks for the clarification. It looks heartbeat more attractive as it can provide more functionality which might be needed down the road. Can you post a sample of your resource, at pastebin (pastebin.com) for example? Thanks in advance!
    – SyRenity
    Jan 11, 2010 at 15:41

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.