I'm trying to figure out how this works. I desperately need to figure out a way to monitor servers and either take any server that sends any 5xx error out of rotation, or failing that, at least redirect the query to a different server.
The clients that use this web service are SOAP/XML clients, so they're not "real" web browsers. Also, we don't use any cookies. It looks like this config just tells the client to make a second request. Am I missing something here? I know I can use httpchk, but I don't want to run "inter 1" because then all my traffic is monitoring traffic. Each server is normally doing several hundred requests per second, and our haproxy test setup is a couple orders of magnitude higher on % of 500 errors. (10% vs .01%). Any ideas? Thanks, Jonah On 6/11/09 7:45 AM, "Maciej Bogucki" <[email protected]> wrote: > Dawid Sieradzki / Gadu-Gadu S.A. pisze: >> Hi. >> >> The problem is how to silent switch to another backend in realtime if >> got 500 answer from backend, without http_client knowledge >> Yes i know, httpchk, but the error 500 is 10 per hour, we don't know >> when and why. >> So, it is a race who get 500 first - httpchk or http_client. >> >> If You don't know what i mean: >> >> example config: >> >> ----8<-------- >> >> frontend >> (..) >> default_backend back_1 >> >> backend back_1 >> option httpchk GET /index.php HTTP/1.1\r\nHost:\ test.pl >> mode http >> retries 10 >> balance roundrobin >> >> server chk1 127.0.0.1:81 weight 1 check >> server chk2 127.0.0.1:82 weight 1 check >> server chk3 127.0.0.1:83 weight 1 check backup >> >> ---->8---------- >> >> http_client -> haproxy -> (backend1|backend2|backend3) >> >> let's go inside request: >> >> A. haproxy recived request from http_client >> B. haproxy sent request from http_client to backend1 >> C. backend1 said 500 internal server error >> >> I want: :-) >> D. haproxy sent request from_http to backend2 (or backup backend or >> another one, or one more time to backend1) >> >> I have: :-( >> D. haproxy sent 500 internal server error to http_client from backend1 >> E. haproxy will mark backend1 as down if got 2 > errror 500 from backend1 >> >> >> It is possible to do that? >> > Hello, > > Yes it is possible but it could be dengerous for some kinde of > application fe. billing system ;) > Here is an example how to do it. I know that it is the hack but it works > good ;P > > frontend fr1 > default_backend back_1 > rspirep ^HTTP/...\ [23]0..* \0\nSet-Cookie:\ > cookiexxx=0;path=/;domain=.yourdomain.com > rspirep ^(HTTP/...)\ 5[0-9][0-9].* \1\ 202\ Again\ > Please\nSet-Cookie:\ > cookiexxx=1;path=/;domain=.yourdomain.com\nRefresh:\ 6\nContent-Length:\ > Lenght_xxx\nContent-Type:\ text/html\n\n<FRAMESET\ cols="100%"><FRAME\ > src="http://www.yourdomain.com/redispatch.pl"> > > backend back_1 > cookie cookiexxx > server chk1 127.0.0.1:81 weight 1 check > server chk2 127.0.0.1:82 weight 1 check > server chk3 127.0.0.1:83 weight 1 check cookie 1 backup > > Remember to set Lenght_xxx properly. > > Best Regards > Maciej Bogucki > > -- Jonah Horowitz · Monitoring Manager · [email protected] W: 415-348-7694 · F: 415-348-7033 · M: 415-513-7202 LookSmart - Premium and Performance Advertising Solutions 625 Second Street, San Francisco, CA 94107

