2

I've been using HAProxy for quite a while but recently got this issue that I don't really know how to implement/solve.

                   +---------------------------+
client-europe \    | HAProxy europe (10.1.0.1) |   / data-center-europe
               |---|                           |->
client-states /    | HAProxy states (10.2.0.1  |   \ data-center-states
                   +---------------------------+

User's will mainly connect via IP stating both proxys in the configuration; something in the likes of app.servers=10.1.0.1,10.1.0.2. What I would like to achieve:

  • if only one HAProxy is up use that
  • if both HAProxy's are up route client to the nearest one
  • prefer data-center closer to HAProxy (solved)

So having HAProxy chose a backend is solved. What I can't do is route the user to another HAProxy. Something in the likes of (hey, I've detected you're connecting from Europe so I'm re-directing you to the 10.1.0.1 ip address).

Frankie
  • 419
  • 1
  • 6
  • 19
  • The solution is Anycast, either for your own ip-range or (only) for your DNS servers. The latter is often called GeoDNS. See this [Q&A](https://serverfault.com/questions/118653/how-can-i-send-visitors-to-the-closest-server-using-dns) or https://serverfault.com/q/489852/37681 – HBruijn Apr 12 '18 at 07:43
  • Are you an AWS user? If so, this sounds like a case for Route 53 Latency-Based Routing, which is a DNS hosting configuration option that returns the IP address of whichever of your targets is closest to the user and in-service according to the associated Route 53 health checks. This works whether the target systems are inside AWS or not. – Michael - sqlbot Apr 12 '18 at 09:41

0 Answers0