What are the requirements for successful health check?

February 21, 2017 1.2k views
Load Balancing Ubuntu 16.04

Can we run a script on the webservers that returns HTTP 200 if the server is properly configured, and HTTP 5xx if something is wrong, so the loadbalancer will take it out?

2 Answers

This is written in the official tutorial:

Health Checks ensure that Droplets are available. By default, they test endpoints every 10 seconds. The health check for our forwarding rule will ping each Droplet’s web server on port 80, and if the server fails to respond after three tries, it will be removed from rotation. The Load Balancer will continue to ping the server, and once it has successfully received a response 5 consecutive times, the server will be returned to the pool.

So I would guess that's kind of a no, but you can run a cronjob script every minute that will close your port 80 or remove the server from the LB group or something else. It's not perfect, but maybe you should suggest it on UserVoice:

edited by asb
  • I'm a bit confused, what is the difference between TCP health checks and HTTP health checks in that case?

Have another answer? Share your knowledge.