Quantcast
Channel: Nginx Forum - How to...
Viewing all articles
Browse latest Browse all 4759

Re: Upstream question

$
0
0
Hi Chris,

Nginx is using a round robin algorithm to decide which host should get the request, since you are (probably) the only user tomcat 1 and tomcat 2 are getting each 50% of the trafic.
Now you want all trafic to go to tomcat 2 because tomcat 1 is down, and you can achieve this by telling Nginx to mark a server as down if it cannot reach it:

upstream backend {
#ip_hash;
server 10.10.10.120:8081 max_fails=3 fail_timeout=30s; # this has a jsp page say "tomcat 1"
server 10.10.10.120:8080 max_fails=3 fail_timeout=30s; # this has a jsp page say "tomcat 2"
}

also ip_hash is telling the Nginx to route all request form a single host to the same backend server.

More info you can find here: http://wiki.nginx.org/HttpUpstreamModule

Viewing all articles
Browse latest Browse all 4759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>