Keepalived startup and check/track script

Sébastien WENSKE <[email protected]>
Newsgroups gmane.linux.keepalived.devel
Message-ID <[email protected]>
Hi List,

I use keepalived to failover two haproxy servers, each have a vrrp_script:

vrrp_script check_haproxy {
  script "killall -0 haproxy"
  interval 2
}

I have one vrrp_instance who is tracking the vrrp_script:

track_script {
    check_haproxy
}

I have an issue when the server starts, HAProxy can't start automatically until I unlock a crypted partition, but Keepalived starts.
So, when I restart the "Master" server, the "Backup" become "Master" as expected.
But, when the "Master" restarts, Keepalived switches to the Master state while HAProxy is not ready, the "Backup" get back to its initial state (that's bad). Then a Master election starts and the "Master" switches to the "Fail" state. This startup behavior causes a few seconds outage.

Is there a way that the tracking script is considered before anything else ?

Thanks,
Sebastien WENSKE

------------------------------------------------------------------------------
The Command Line: Reinvented for Modern Developers
Did the resurgence of CLI tooling catch you by surprise?
Reconnect with the command line and become more productive. 
Learn the new .NET and ASP.NET CLI. Get your free copy!
http://sdm.link/telerik
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.