2

I've been searching for a way to add and remove backend servers from HAProxy dinamically, is there a wrapper or even an API to handle it? I want to make an auto-scale system with HAProxy and DigitalOCean. Others load-balancers are welcome.

Pedrommone
  • 29
  • 1
  • 2

3 Answers3

2

There is no API or anyway to do what you want. You need to add the backends into the config and do a graceful reload.

What that does is it spins off another haproxy process to handle the traffic and the other process waits till it finishes and quits. You should be able to reload haproxy with no connection refused or bad requests.

Mike
  • 22,310
  • 7
  • 56
  • 79
1

Since this question appear in search result, I'd like to put updated reference here.

This is an article by HAproxy that answer the question above.

HAProxy dynamic scaling runtime API

eLAN
  • 111
  • 2
0

You shouldn't need to. HAProxy won't balance to a backend without a good healthcheck so just add extra ones. Also you can control server weights.

JamesRyan
  • 8,166
  • 2
  • 25
  • 36