nginx: [emerg] host not found in upstream

Francis Daly francis at daoine.org
Mon Dec 14 10:53:36 UTC 2020


On Mon, Dec 14, 2020 at 12:45:00PM +0530, Praveen Kumar K S wrote:

Hi there,

> I'm facing issue where if one of the upstream servers is down, nginx going
> to emerg mode with the subjected error.

Generally, nginx does not care if individual IP:ports defined in an
"upstream" are accessible or not.

nginx does care that any hostnames used in "upstream" can be resolved
at nginx-start-time using the system resolver, and will fail with an
error like "host not found in upstream" if one does not resolve.


Are you reporting that nginx stops working when an upstream server is
down; or are you reporting that nginx fails to start when an upstream
server is down?

And if the latter -- does the hostname that you have configured nginx
to talk to, resolve, when the upstream server is down?

> My requirement is, nginx should go down when all of the upstream servers
> are down.
> But when even one of the upstream servers is up, nginx should still serve
> the requests by proxying requests to that one live upstream server. 

What you describe in that last sentence is the expected behaviour.

If you are not seeing that -- can you provide a fuller description of
your setup?

If you have unreliable name resolution, you may be able to change your
"upstream" config to use the IP addresses, which would avoid nginx having
to try name resolution.

Cheers,

	f
-- 
Francis Daly        francis at daoine.org


More information about the nginx mailing list