Hello,

Can you see failed check in your stats page ? Because if one of your
server goes down, then came back, haproxy will probably send the
request to another server.

See "map-type" parameter in
http://haproxy.1wt.eu/download/1.4/doc/configuration.txt

"consistent" one will be good for you.

Hervé.

On Wed, 25 Aug 2010 18:00:01 +0200
Markus Fröhlich <[email protected]> wrote:

>   hi!
> 
> I'm using HA-Proxy version 1.4.8 2010/06/16 on SLES11 SP1 x64
> my backend servers are three squid proxy servers to cache images.
> 
> what I want:
> I'd like to cache each picture ONLY on one proxy server for following
> reasons:
>   * it makes no sense to waste cache capacity and keep the same
> picture in cache on all three proxy backends
>   * no different versions of the same picture, when the picture got
> updated and the caching times of the proxies are different - so it is
> possible, that one proxy shows the old picture and the others the new
> one
> 
> so I use "balance uri" option
> therefor a hash of the URI will be generated and haproxy will send
> the same URI / hash always to the same backend proxy assumed the
> backend server dosnt go down or squid isnt aviable. when I watch the
> squid access logs of the backend proxies, it works sometimes and
> sometimes I get the same picture (same URI) from an other proxy. why
> isnt it persistant?!
> 
> the testet URIs look like this:
> http://images5.<domain>.<TLD>/image_data/02/29/73/69.crop-100.80-80-80-80.orig.jpg?chk=340293d69ffc5d944a449891869f1a74
> http://images5.<domain>.<TLD>/image_data/02/53/56/97.crop-100.120-120-120-120.orig.jpg?chk=7914ffc6a00d4702bdc3cdbd83bdbca9
> http://images5.<domain>.<TLD>/image_data/dynimage/3b267cf984acb80a117454f0f6ae42df/1238e767062f89acba5faa86d994a789.gif?chk=793ecb49681273cbd9667578acbe4951
> 
> 
> my haproxy.cfg:
> global
>      node vvx-haproxy-03
>      user haproxy
>      group haproxy
>      daemon
>      maxconn 256
> 
> defaults
>      mode    http
>      option clitcpka
>      timeout connect 5000ms
>      timeout client 50000ms
>      timeout server 50000ms
>      option httpchk
>      http-check send-state
> 
> frontend http-in
>      log /dev/log local0 debug
>      option  httplog
>      option logasap
>      option socket-stats
>      bind x.x.x.x:80
>      acl invalid_src  src          0.0.0.0/7 224.0.0.0/3
>      acl local_dst    hdr(host) -i localhost
>      block if invalid_src || local_dst
>      default_backend proxy1
> 
> backend proxy1
>      log /dev/log local1 debug
>      option  httplog
>      option tcplog
> 
>      stats enable
>      stats hide-version
>      stats scope .
>      stats uri /xadmin?stats
>      stats realm HAproxy\ Statistics
>      stats auth xadmin:<pwd>
>      stats show-legends
>      fullconn   10000
>      balance uri len 128 depth 8
>      option srvtcpka
> 
>      server p-01 10.x.x.x:80 maxconn 32 check inter 10000
>      server p-02 10.x.x.x:80 maxconn 32 check inter 10000
>      server p-03 10.x.x.x:80 maxconn 32 check inter 10000
> 
> 
> 
> 



-- 
Hervé COMMOWICK, EXOSEC (http://www.exosec.fr/)
ZAC des Metz - 3 Rue du petit robinson - 78350 JOUY EN JOSAS
Tel: +33 1 30 67 60 65  -  Fax: +33 1 75 43 40 70
mailto:[email protected]

Reply via email to