Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

All of the examples I've seen of using upstream (for load balancing) in nginx look like this:

upstream  backend  {
  server   backend1.example.com:8080          max_fails=3  fail_timeout=30s;
  server   backend2.example.com:8080          max_fails=3  fail_timeout=30s;
  server   backend3.example.com:8080          max_fails=3  fail_timeout=30s;
}

It seems repetitive to re-set max_fails and fail_timeout for each backend, when typically they are always the same. Is it possible to set max_fails and fail_timeout for all of the backend servers at once?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Specify proxy_upstream_fail_timeout and proxy_upstream_max_fails in your server {} config

See
http://wiki.nginx.org/HttpProxyModule#proxy_upstream_fail_timeout
http://wiki.nginx.org/HttpProxyModule#proxy_upstream_max_fails
For more info

share|improve this answer
    
Thanks. Those are marked as deprecated, is there any reason why that is? –  John Smith May 22 '11 at 17:25
    
Hmm not sure, didn't realize they were depreciated (Posted the links from memory) but I'm running NGINX 1.0.1 and those directives still work, there may be a performance benefit from using the directives in an upstream server specifier (proxy_upstream_* relates to using the proxy mod, upstream {} flags apply to the upstream module. I'll do a bit of research (If there is a difference it would be beneficial to my own applications) and get back to you –  sam May 22 '11 at 17:34
    
Will proxy_upstream_* make Nginx send the request to one of the other upstream servers on error? Intuitively I don't think so. –  i.amniels May 23 '11 at 18:22

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.