HAProxy for API calls ?


Renowned Member
Nov 20, 2014
We do have a lot of API calls from different external applications.
Each currently pointing to a master host which we expect to have as stable as possible.
Should we put a haproxy beforehand to have to the api calls distributed over the different hosts ?
If the application would be able to get the IPs of the different running nodes we could randomize the api call targets inside the application. But how to get the iplist to do the proxiing by myself. (ok a nslookup could be done for every host but a api return value would be nicer....)

Any proposals for haproxy (first choice ) or the list of node ips.
Should we put a haproxy beforehand to have to the api calls distributed over the different hosts ?
Where would the haproxy run - if it's a single instance this becomes your new single point of failure - no api-requests get routed if the node/host where it's running is down - and setting it up with redundancy and floating IP's is a bit more involved (but can work of course)

As for getting the list of ip's of nodes in a cluster - the api route /cluster/status should contain this information

Hope this helps!
sure that HAproxy would be a single point of failure too but to widespread the amount of api calls over the different nodes this could help. and for HA proxy redundancy there are also some solutions available

pvesh get /cluster/status
returns just
│ type │
│ cluster │
│ node │
│ node │
│ node │
try `pvesh get /cluster/status --output-format json-pretty`

(the tabular output of pvesh does not always return all values, and you'd get json-output via the REST-API anyways)


The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!