I need to upgrade our current infrastructure based on a single server to a multi server one. Basically we run an HTTP app, MySQL and other services.
My idea is to put HAProxy on all the servers so they can balance/failover themselves.
Something like this:
WAN | | |------| |------| | HAP1 | | HAP2 | HAProxy servers |------| |------| \ / ----X---- / \ |------| |------| | NGX1 | | NGX2 | Nginx webservers |------| |------|
The idea is to configure the public hostname with round-robin DNS pointing to HAP servers, which will then balance to the web servers.
In order to have a not totally randomic balance I wish to use leastconn algorithm, but here comes the problem: is it possible for HAP servers to share each other how they balanced the incoming connections? I'd like to avoid both servers considering a backend offloaded because of upstream round robin.
EDIT: I'd like to avoid using keepalived and a virtual IP shared by the two HAP because the servers will be in different datacenters.