Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'm running keepalived under Debian (Lenny, Squeeze) in a fairly simple setup, I'm just (ab)using it as a VRRP daemon to decide the mastership between two equal machines for some virtual IPs. All the magic happens in the notify-script.

When I completely stop the daemon (using debian's init-script) keepalived does not run the notify-script for backup or at least fault mode, which is what I would suspect and need.

I could "fix" the rc-script with some unwanted effects - the notify-script would be hard-coded into the rc-script introducing an unwanted coupling of these two and the mess of porting the patch to the next debian versions so this is not the way I really want to go...

Any hints for a cleaner solution to this problem?

vrrp_instance FOORRP {
  virtual_router_id 42
  interface eth0
  state BACKUP
  priority 200
  nopreempt
  authentication {
    auth_type AH
    auth_pass foobar42
  }
  notify "/usr/local/bin/vrrp-state"
  virtual_ipaddress {
    127.0.0.2
  }
}

PS: the use of the "three notify_"-scripts does not change anything

PPS: in the changelog (Release 1.1.16) there is something mentioned, that somehow fits my problem (though I am not using anything lvs-related in keepalived), but I am using a newer version (1.1.20): "notify_down isn't executed for working real servers on keepalived shutdown."

share|improve this question

2 Answers 2

up vote 3 down vote accepted

Dug through more documentation and finally found it:

notify_stop "/usr/local/bin/vrrp-state fault"

Works as expected.... X-}

share|improve this answer

I faced such an issue recently and I found it is logical to not execute these scripts. These scripts get executed in case of specific events like becoming a master or slave. Keepalived process should not be shutdown unless it is done manually and there is a good reason to do so. If you are worried about failure in keepalived process (not the case of manually shutting it down), you can use monit. It is a great tool to monitor your running processes and restart them if anyone fails.

As you mentioned, you can simply modify the startup script of keepalived to execute the desired script (like stopping some other service). I think this will be cleaner than patching keepalived code, maintaining it yourself, and doing the necessary patch again each time you want to re-install/upgrade it.

share|improve this answer
    
I have a good reason to shutdown keepalived - maintainance! (I haven't seen keepalived crashing for years now, though I've seen it messing up. But thats not my point here.) And - as I wrote - editing the rc script is a technical solution but with unwanted administrative overhead. Finally: "not running these script" is no solution at all, since this script does all my failover stuff! (which is more than keepalived can do) –  Michuelnik May 8 '12 at 7:28
    
@Michuelnik: So, this will be part of your maintenance anyway. You can include this in keepalived startup script or run it manually. –  Khaled May 8 '12 at 7:30

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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