On Thu, May 17, 2012 at 3:18 PM, Виктор Ефимчик <[email protected]> wrote: > > Hello, > > There is a question regarding HAProxy redirection algorithm: > > Is it possible to force HAProxy to redirect the request which reaches the > server and while processing the request the server crashes? Can HAProxy > detect such situation and handle them without additional round trip to the > client? > > To be more precise, here is the configuration and more details: > > Client -----------> HAProxy ---------------> Server1 > | > ------------> Server2 > > When the request comes from Client, HAProxy selects Server1 to process the > request. HAProxy forwards the request to Server1, but while processing > Server1 crashes (e.g. System.exit(0) - terminates the currently running > JVM). As a result, HAProxy does not receive any reply and on the client side > we receive timeout error. > The question arise in this case: is it possible to configure HAProxy to > forward the request to Server2 after a specified timeout? > > Below you can find the content of haproxy.cfg file: > > > global > log 127.0.0.1 local0 > log 127.0.0.1 local1 notice > chroot /var/lib/haproxy > pidfile /var/run/haproxy.pid > maxconn 4000 > user haproxy > group haproxy > daemon > stats socket /var/lib/haproxy/stats > > defaults > mode http > log global > option dontlognull > option redispatch > retries 3 > clitimeout 60000 > srvtimeout 60000 > contimeout 5000 > maxconn 3000 > > listen jboss 192.168.208.205:8080 > balance roundrobin > option httplog > #cookie JSESSIONID indirect nocache > capture cookie JSESSIONID len 52 > appsession JSESSIONID len 52 timeout 1h > option forwardfor > server node1 10.0.0.4:8080 cookie node1 check > server node2 10.0.0.5:8080 cookie node2 check > option redispatch > > listen dbs 10.0.0.1:3306 > mode tcp > option tcplog > balance roundrobin > server node1 10.0.0.4:3306 check > server node2 10.0.0.5.209:3306 check > option redispatch > > listen adm_stats 10.0.0.1:15151 > mode http > stats uri /stats > stats realm HAPROXY > stats auth admin:admin > stats refresh 5 > > > Many thanks in advance. > > With best regards, > Victor. >
Hi Victor, As soon as the request has left HAProxy, it can't be resent to an other server. HAProxy can choose an other server only if it can't send the request to the first one (and have not sent yet the request, of course) cheers

