Welcome! Log In Create A New Profile

Advanced

Re: nginx: [emerg] host not found in upstream

Praveen Kumar K S
December 14, 2020 08:30AM
Hello,

1. nginx fails to start when an upstream server is down or not being
resolved.
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.
3. Now I get your point. When nginx starts, it should resolve all upstream
servers. Else, it will fail to start.

Now, let me explain my issue. Please let me know if this is possible.
1. Today I have 3 servers defined in upstream. Lets say app1,app2,app3
2. Tomorrow I might scale the app by 2 more. Lets say app4,app5
3. Now I want to define that [app4,app5] in my nginx configuration
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.

On Mon, Dec 14, 2020 at 4:23 PM Francis Daly <francis@daoine.org> wrote:

> 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@daoine.org
> _______________________________________________
> nginx mailing list
> nginx@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>


--


*Regards,*


*K S Praveen Kumar*
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

nginx: [emerg] host not found in upstream

Praveen Kumar K S December 14, 2020 02:16AM

Re: nginx: [emerg] host not found in upstream

Francis Daly December 14, 2020 05:54AM

Re: nginx: [emerg] host not found in upstream

Praveen Kumar K S December 14, 2020 08:30AM

Re: nginx: [emerg] host not found in upstream

Francis Daly December 14, 2020 04:58PM

Re: nginx: [emerg] host not found in upstream

Praveen Kumar K S December 16, 2020 08:08AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 279
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready