Can I monitor another server using keepalived?
I have 2 HAProxy linodes running as load balancers in front of my DB nodes . I want to use one as MASTER and the other as BACKUP to maintain a High Availability setup. (I can't use a Linode Nodebalancer for reasons I won't get into here.) However, I can't use the IP Failover that Keepalived is designed for, since we are using the Toronto Datacenter and IP Sharing is not available (yet).
What I would like to do is to run keepalived on a separate server (my web facing server), and use a script to continuously check whether that server can connect to the MySQL DB through HAProxy-1 (master). If HAProxy-1 goes down or the connection to the DB is interrupted for any reason, keepalived would run a script to update my web server config to set the DB IP to HAProxy-2 (backup).
Can anyone point me to a tutorial or example configuration for this? I have been fiddling with the keepalived configs, but I cannot get it to work. It appears that keepalived on the separate server doesn't understand that it is monitoring a remote service, so it is advertising itself as DOWN instead of the remote HAProxy server. Every keepalived example I have found only has one "instance" config on each server (to monitor itself), rather than 2 like I am trying to do…
Maybe this is just what keepalived does - in that case, is there a different monitoring tool that can easily do this?
Thanks in advance for your wisdom and guidance. :)
This is a very good question, and I have not personally attempted to set up a High Availability situation in the manner that you describe.
I want to do my best to steer you in the right direction, so I'm going to provide you with our guide on configuring High Availability in case there's something additional in there that might help:
What I do want to do, though, is give this post more visibility to the Linode Community, so that other users can share their configurations with you. I've added some tags to this post to do that.
We'll be interested to know of any successes you have when playing with your configurations, so please let us know what you're able to work out.