<div dir="ltr"><div dir="ltr">Hello,<br><div><br></div><div>1. nginx fails to start when an upstream server is down or not being resolved.</div><div>2. I can't use the ipaddress because I'm running all services in docker swarm. So I can only resolve using the service names.</div><div>3. Now I get your point. When nginx starts, it should resolve all upstream servers. Else, it will fail to start.</div><div><br></div><div>Now, let me explain my issue. Please let me know if this is possible.</div><div>1. Today I have 3 servers defined in upstream. Lets say app1,app2,app3</div><div>2. Tomorrow I might scale the app by 2 more. Lets say app4,app5</div><div>3. Now I want to define that [app4,app5] in my nginx configuration</div><div>4. But I thought of defining app1,2,3,4,5 upfront in nginx conf and scale my app whenever required. In this case, when nginx is unable to resolve app4,5, it should ignore and when I scale my app, it should load balance the requests to all 5.</div><div><br></div></div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Dec 14, 2020 at 4:23 PM Francis Daly <<a href="mailto:francis@daoine.org">francis@daoine.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Mon, Dec 14, 2020 at 12:45:00PM +0530, Praveen Kumar K S wrote:<br>
<br>
Hi there,<br>
<br>
> I'm facing issue where if one of the upstream servers is down, nginx going<br>
> to emerg mode with the subjected error.<br>
<br>
Generally, nginx does not care if individual IP:ports defined in an<br>
"upstream" are accessible or not.<br>
<br>
nginx does care that any hostnames used in "upstream" can be resolved<br>
at nginx-start-time using the system resolver, and will fail with an<br>
error like "host not found in upstream" if one does not resolve.<br>
<br>
<br>
Are you reporting that nginx stops working when an upstream server is<br>
down; or are you reporting that nginx fails to start when an upstream<br>
server is down?<br>
<br>
And if the latter -- does the hostname that you have configured nginx<br>
to talk to, resolve, when the upstream server is down?<br>
<br>
> My requirement is, nginx should go down when all of the upstream servers<br>
> are down.<br>
> But when even one of the upstream servers is up, nginx should still serve<br>
> the requests by proxying requests to that one live upstream server. <br>
<br>
What you describe in that last sentence is the expected behaviour.<br>
<br>
If you are not seeing that -- can you provide a fuller description of<br>
your setup?<br>
<br>
If you have unreliable name resolution, you may be able to change your<br>
"upstream" config to use the IP addresses, which would avoid nginx having<br>
to try name resolution.<br>
<br>
Cheers,<br>
<br>
f<br>
-- <br>
Francis Daly <a href="mailto:francis@daoine.org" target="_blank">francis@daoine.org</a><br>
_______________________________________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org" target="_blank">nginx@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx" rel="noreferrer" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><font style="font-family:"courier new",monospace" size="1"><b style="color:rgb(102,102,102)">Regards,<br><br></b></font><div style="color:rgb(102,102,102)"><font size="1"><b><font face="'comic sans ms', sans-serif"><font style="font-family:"courier new",monospace" size="1">K S Praveen Kumar<br></font><br></font></b></font></div></div></div>