You could do something like this. Setup the haproxy status page on the haproxy server.
Then create a bash script with syntax like this #!/bin/bash # value=$(curl -I http://www.example.org 2>/dev/null | head -n 1 | cut -d$' ' -f2) if [ $value -eq 200 ] then exit else exit 1 fi that will return 0 if it's up and 1 if it's down. So if you change your track_script to use that bash script it'll then base whether or not haproxy is up based on if it can access that status page. -----Original Message----- From: Markus Rietzler [mailto:[email protected]] Sent: Thursday, June 08, 2017 8:32 AM To: [email protected] Subject: Re: High Availability for haproxy itself Am 02.06.17 um 11:35 schrieb Raphaël Enrici: > Hi, > > if you are in a simple case where you only need some kind of active/passive > solution without big scaling needs on a > Linux system, look for "haproxy keepalived" on your favorite search engine, > you'll find many articles explaining the way > to go. > > If you need HA and horizontal scaling, take a look at the article from > Vincent Bernat here: > https://vincent.bernat.im/en/blog/2013-exabgp-highavailability > > HTH, > Raph > > > Le 2017-06-02 10:34, Jiafan Zhou a écrit : >> Hi, >> >> Haproxy ensures the HA for real servers such as httpd. However, in the >> case of haproxy itself, if it fails, then it requires another instance >> of haproxy to be ready. Is there any High Availability solution for >> haproxy itself? >> >> Regards, >> Jiafan > > Hi, keepalived works very well. i have a setup with haproxy running on two VM which are connected via keepalived. the node (to be exact the virtual IP address) is switched if i stop haproxy on my master. then haproxy on my fallback node will "jump in". if i restart haproxy on master the IP is switched back... this works very stable in the last years. the only thing which i could optimize is the healthcheck in keepalived. at the moment i do a simple "is the process running" (killall -0 haproxy) test. i think this could be optimized. Eg. don't know if it would recognise a hanging haproxy process correctly. maybe it would be better to do some http access and look at the answer (eg. do i get an "OK" back) or check the response time and switch if it tooks too long... Markus ________________________________ Information in this e-mail may be confidential. It is intended only for the addressee(s) identified above. If you are not the addressee(s), or an employee or agent of the addressee(s), please note that any dissemination, distribution, or copying of this communication is strictly prohibited. If you have received this e-mail in error, please notify the sender of the error.

