Haproxy routing to single backup server from multiple nodes

cn flag

I have several small server and one big server that contain mirror of that several small server. Let's call it Server A, Server B, Server C and Server D for group of small server, and the big server will have Server X as name.

I'm drawing this diagram to explain the setup.

enter image description here

I want to redirect user to Server X if one of Server A to D is down/unreachable, once the server is gone up the user would have been redirected back to their corresponding server. Below is an example of desired scenario.

  • John search up hosted on Server B.
  • Haproxy redirect John to Server B.
  • John is doing something on on server B.
  • Server B is down ! John got redirected to Server X.
  • John is doing something on on server X.
  • Server B is up ! John got redirected back to server B from Server X.

I want to do the same setup with all other server (Server A to D), hence I only needed a failover and not load balancer.

I'm pretty sure this is possible with haproxy, but I haven't find a way to do this setup. Can anyone who knowledgeable give me a way/hint to perform this setup.


Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.