[Pacemaker] run script when vip failover happens

Ken Gaillot kjgaillo at gleim.com
Fri Aug 8 11:04:15 EDT 2014

On 08/08/2014 01:49 AM, Alex Samad - Yieldbroker wrote:
> Hi
> So I have taken a slightly different approach, I have taken ocf::heartbeat:IPaddr2 copied it to ocf::yb:namedVIP and I have added in some code to
> 1) check to see if named is running
> 2) reload when it adds/removes an ip address
> All seems good except

Except what?!? Don't leave us hanging! ;-)

This can be (acceptably) handled by the stock agents. We have a similar 
setup, and do this:

    order dns-restart +inf: dns-ip:start dns-daemon-clone:start

dns-ip is our IPaddr2 resource, and dns-daemon-clone is the clone of the 
named resource. So the above tells pacemaker to always start 
dns-daemon-clone after dns-ip starts, which in practice makes it do a 
full restart of named if dns-ip moves to the host. Your approach has the 
advantage of being able to do a lighter-weight reload, but the above is 

Once or twice in our setup, named did not get restarted as expected, but 
that was so rare it wasn't worth trying to track down.

I had also considered this approach:

    primitive dns-rebind ocf:heartbeat:anything params 
binfile="/usr/sbin/rndc" cmdline_options="reconfig"

    group dns-cluster dns-ip dns-rebind meta target-role="Started"

which also has the advantage of doing a reload instead of full restart, 
but it abuses the anything resource to do something it wasn't meant to do.

>> -----Original Message-----
>> From: Alex Samad - Yieldbroker [mailto:Alex.Samad at yieldbroker.com]
>> Sent: Friday, 8 August 2014 2:44 PM
>> To: pacemaker at oss.clusterlabs.org
>> Subject: [Pacemaker] run script when vip failover happens
>> Hi
>> I have a 2 node cluster. I want to run named on both and have 2 vips that are
>> distributed, but I don't want to stop and start named when the vip moves.
>> But named doesn't automatically start to listen on the new IP address you
>> have to do a reload.  So how can I attach a script to run when the vip moves
>> to a node ?
>> Alex

-- Ken Gaillot <kjgaillo at gleim.com>
Network Operations Center, Gleim Publications

More information about the Pacemaker mailing list