Re: Sticking to a particular server for testing...

From: Unai Rodriguez <me#u-journal.org>
Date: Thu, 03 Jul 2008 00:57:10 -0600


> Generally, people rely on a cookie and set a cookie on their browser
> (potentially through an admin page on the application itself) and from
> this cookie, haproxy selects the appropriate server. Example :

Just to share with you, while testing we usually skip the HAProxy and force the testing machine to connect to a specific web server by over-riding the DNS information using the hosts file (C:\windows\system32\drivers\etc\hosts under Windows or /etc/hosts under Linux).

Let's say, we have:

And the DNS is set to resolve to the HAProxy server, meaning:

nslookup or dig site.example.com resolves as: 10.1.1.1

Then we would add on the hosts file this line:

site.example.com 10.1.1.2 (to force it to web1)

-OR-

site.example.com 10.1.1.3 (to force it to web2)

I know it is not the same and it is a little bit manual, but this is what we do to make sure things are OK.

One other thing, it is related, it was asked recently but I did not fully understand the answer... If HAProxy is performing load balancing based on source IP, what has precedence, the source ip or the cookie?

Let's say, according to the source ip balancing a client should go to server#3 but he has a cookie pointing to server#1. Where is he going?

thanks guys,
unai Received on 2008/07/03 08:57

This archive was generated by hypermail 2.2.0 : 2008/07/03 09:00 CEST