Re: Question about TCP balancing

2009-08-06 Thread Dmitry Sivachenko
On Thu, Aug 06, 2009 at 12:03:25AM +0200, Willy Tarreau wrote:
 On Wed, Aug 05, 2009 at 12:01:34PM +0400, Dmitry Sivachenko wrote:
  On Wed, Aug 05, 2009 at 06:30:39AM +0200, Willy Tarreau wrote:
   frontend my_front
 acl near_usable nbsrv(near) ge 2
 acl far_usable  nbsrv(far)  ge 2
 use_backend near if near_usable
 use_backend far  if far_usable
 # otherwise error
   
   backend near
 balance roundrobin
 server near1 1.1.1.1 check
 server near2 1.1.1.2 check
 server near3 1.1.1.3 check
   
   backend far
 balance roundrobin
 server far1  2.1.1.1 check
 server far2  2.1.1.2 check
 server far3  2.1.1.3 check
   
  
  Aha, I already came to such a solution and noticed it works only
  in HTTP mode.
  Since I actually do not want to parse HTTP-specific information,
  I want to stay in TCP mode (but still use ACL with nbsrv).
  
  So I should stick with 1.4 for that purpose, right?
 
 exactly. However, keep in mind that 1.4 is development, and if
 you upgrade frequently, it may break some day. So you must be
 careful.
 

Okay, what is the estimated release date of 1.4 branch?



Re: disable-on-404

2009-08-06 Thread Kent Noonan
Actually I figured it out with the help from Benoit. It looks like when
just specifying the URI haproxy still uses the OPTIONS method to check?
For some reason it wasn't returning a 404 error if the file wasn't
there, it may be the way IIS works but I don't have anything to test
this with. Anyway I added the HEAD method and all is fine and working
correctly now. 

Thanks

Kent


Kent Noonan
Network Engineer
North Kansas City School District
Desk: 816-413-5151
Cell: 816-674-9101








 On Wed, Aug 5, 2009 at  5:08 PM, Willy Tarreau w...@1wt.eu wrote: 
 On Wed, Aug 05, 2009 at 02:55:54PM +0200, Benoit wrote:
 Kent Noonan a écrit :
  Hello all...
 
  I am working on a new setup and am having an issue, that I will
admit, is 
 probably me misreading the docs. We have a couple of other load
balance 
 solutions, so I am not new to the concept, this is just our first use
of 
 haproxy. 
 
  I have 5 backend servers and I am trying to configure it so they
can be 
 taken out of service by using the availability of a file. Here is the

 relevant config section:
 
  backend application-servers
  balance roundrobin
  appsession session_id len 32 timeout 1h
  mode http
  http-check disable-on-404
  option httpchk /alive.htm
  server bb-app1 10.200.35.1:80 check
  server bb-app2 10.200.35.2:80 check
  server bb-app3 10.200.35.3:80 check
  server bb-app4 10.200.35.4:80 check
  server bb-app5 10.200.35.5:80 check
 
  What I am trying to do is if a file exists at the uri of
/alive.htm the 
 server is available. If that file gets deleted off of the server that
server 
 will be taken out of service for new connections and still allow
existing 
 connections. For some reason this isn't working, when looking at the
stats 
 page all servers show UP even though only one of the servers has the

 /alive.htm file on it. I am running 1.3.19 on a 64bit architecture. 
 
  Can anyone see what I am missing, or have any other words of
wisdom to 
 hopefully get this working for me?
 
  Thanks
  Kent

 
 I was using   option httpchk HEAD /nagios.htm HTTP/1.0\r\nHost:
127.0.0.1
 and no special htto-check disable-on-404 and it worked fine, in
 1.3.15.4 at least.
 
 And coincidently, I've been using it today too on 1.3.19 and it
worked.
 
 Are you sure that it's not because of your appsession cookies that
you
 still see traffic on your servers ?
 
 Willy




balancing the load evenly

2009-08-06 Thread Magnus Hansen @ mingoville

Hello...

I am very happy with the haproxy, but the result of my loadbalancing  
confuses me...


I believe my configuration is fine, but one of my servers are getting  
hit much more than the others
I have tried with leastconn, roundrobin, and source. All are producing  
more or less the same result which is that the same one of my servers  
is chosen above the others...


My main newbee question is of course Am i missing something?

The one usually getting hit is jettysmall1 and even lowering the  
weight seems to help The lowest weight i have tried is half as  
much as the others



Many thanks

Magnus

global
log 127.0.0.1   local0
log 127.0.0.1   local1 notice
#log loghostlocal0 info
maxconn 600
user root
group root

defaults
log global
modehttp
option  httplog
option  dontlognull
retries 5
option  redispatch
contimeout  15000
clitimeout  19
srvtimeout  19
option  httpclose
option  forwardfor

listen webfarm 10.244.186.18:80
modehttp


acl url_jetty  path_beg /info /um /ws /amf /sm /fm /product /game
acl url_php path_end php
acl url_unilogin path /um/login/unilogin.php

stats   enable
stats   hide-version
stats   uri /admin?stats
stats   realm   Haproxy\ Statistics
stats   authadmin1:passwd

use_backend jetty if url_jetty !url_php or url_unilogin 
default_backend static

backend jetty

balance source # or leastconn or rounrobin
cookie HAP_SERVERID insert nocache indirect

	server jettysmall2 10.244.126.97:8080 cookie omega maxconn 150 weight  
10 maxqueue 30 check fall 10 inter 4000
	server jettysmall3 10.244.125.175:8080 cookie delta maxconn 150  
weight 10 maxqueue 30 check fall 10 inter 4000
	server jettysmall4 10.244.150.245:8080 cookie epsilon maxconn 150  
weight 10 maxqueue 30 check fall 10 inter 4000
	server jettysmall1 10.244.146.51:8080 cookie gamma maxconn 150 weight  
7 maxqueue 30 check fall 10 inter 4000



backend static
balance source  # or whatever
server apache1  10.244.186.18:81








'errorfile' behavior for ACL rules?

2009-08-06 Thread Mathew Hennessy
Hi,
I was wondering if there was support within haproxy to return the
content of a file as a result of an ACL, similar to how 'errorfile'
returns the content of a file when haproxy gets that error from the
underlying?

For example, I want this to do what I mean:

acl under_construction nbsrv(pool) lt 1
printfile ./underconstruction.html if under_construction

So if less than 1 of the members of 'pool' are reported up, emit a
static page without depending on it being available on a pool member or
some remote host that may or may not be available.  

Or is it already there and I'm missing it in the docs?

Thanks,
= MAtt





Multiple config files

2009-08-06 Thread Jeremy
Quick sanity check please ... There doesn't seem to be a way to include
multiple config files, just one, right? Sort of like how Apache can include
conf.d/*.conf etc.

If possible I'd like to set up a separate config file for each site (a
frontend + multiple backends) to avoid ending up with a single monolithic
config file if this set of servers grows to a large number of sites, but
this doesn't seem to be an option currently, just wanted to double check.

I guess I could keep all the configs separate and just cat them all together
again if I need to change one little thing.