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.

Does nginx go to the next host in upstream block, if previous host not available or doesn't exist?

upstream cache_cluster {
   127.0.0.1:9000;     //something on this port
   127.0.0.1:11211;   //memcached instance on this port
}

location  {
 //..some code here
 memcached_pass cache_cluster;
 error_page 404 502 504 =  @something;
}
share|improve this question

1 Answer 1

up vote 2 down vote accepted

upstream only provide a list of servers, and some kind of weight. To tell Nginx what to do if one of the servers fail, you need to control this with memcached_next_upstream.

From the Nginx-documentation:

memcached_next_upstream

syntax: memcached_next_upstream [ error | timeout | invalid_response | not_found | off ]

default: error timeout

context: http, server, location

Which failure conditions should cause the request to be forwarded to another upstream server? Applies only when the value in memcached_pass is an upstream with two or more servers.

As stated in the documentation, the default behaviour is error / timeout, which should be sufficient in most cases.

share|improve this answer

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.