Obviously there should be a downtime page located on a web server devoted to downtime page. The page should contain a short description and be transfered with HTTP status 503.

Assume we have load balancer and few web servers. Downtime should be started in two cases:

  1. Planned technical support
  2. Real downtime, web servers are unavailable

One of the solution would be to do redirection from load balancer. How van HAProxy now if a web server is down or unabvailable and send all requests to a downtime page on another server?

link|improve this question

60% accept rate
feedback

2 Answers

up vote 2 down vote accepted

You can specify a backup server in the haproxy config file, on the server line, e.g.

server R1 127.0.0.1:9081 backup

And in this case the web server bound to port 9081 on the local machine will serve content when all servers are down (failed health-check), or all servers are in maintenance mode. You could run a lightweight secondary webserver (e.g. nginx) purely for hosting the maintenance page.

You can intentionally put a server into maintenance mode by sending a command to the stats socket, assuming you have configured one like this:

global

stats socket /var/run/haproxy.stat mode 600 level admin

Then your command will be something like:

echo "disable server yourbackendname/yourservername" | socat stdio /var/run/haproxy.stat

but note that the above requires socat to be installed.

link|improve this answer
feedback

You can configure haproxy with your servers as you normally do, and it will load balance the requests among them. The other server which serves the downtime page should be configured as backup server in haproxy.

The backup server will be only used when all servers are down. The haproxy can monitor the health of the web servers and thus it knows when any server is down.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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