DNS resolution of backends

Hi guys

We run a reverse proxy to Amazon S3 service. Sometime Amazon change
their
IPs and some of them may become unresponsive and render reservse proxy
unusuable. Is there options to force nginx to re-resolve IPs of backends
lets say each 5 mins ?

Thanks !

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,250669,250669#msg-250669

We run a reverse proxy to Amazon S3 service. Sometime Amazon change their
IPs and some of them may become unresponsive and render reservse proxy
unusuable. Is there options to force nginx to re-resolve IPs of backends
lets say each 5 mins ?

Give the upstream{} block the hostnames of the instances and add an
resolver
( http://nginx.org/en/docs/http/ngx_http_core_module.html#resolver ).

Optionally add valid=5m; if the TTL of the domain is not optimal.

p.s. for the nginx to be more responsive you can also tweak the connect
timeouts like proxy_connect_timeout (
http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_connect_timeout
) as the default is quite high - 60 seconds.

rr

Sounds exactly like what I’m looking for thank you Reinis !

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,250669,250677#msg-250677

Hello!

On Thu, Jun 05, 2014 at 06:20:35PM +0300, Reinis R. wrote:

We run a reverse proxy to Amazon S3 service. Sometime Amazon change their
IPs and some of them may become unresponsive and render reservse proxy
unusuable. Is there options to force nginx to re-resolve IPs of backends
lets say each 5 mins ?

Give the upstream{} block the hostnames of the instances and add an resolver
( http://nginx.org/en/docs/http/ngx_http_core_module.html#resolver ).

This won’t make any difference. Names of servers in upstream{}
blocks are resolved during configuration parsing, and won’t be
re-resolved till next configuration parsing.

To ensure periodic hostname resolution, one have to use a
hostname (not an upstream block) in proxy_pass, and variables in
the proxy_pass directive. This way, nginx won’t know a hostname
in advance, and will have to use resolver to resolve it, resulting
in a periodic hostname resolution.

(Alternatively, a special “resolve” flag for servers in upstream{}
blocks was recently introduced of the commercial subscription, see
http://nginx.org/en/docs/http/ngx_http_upstream_module.html#server.
But this requires commercial subscription.)


Maxim D.
http://nginx.org/

Ok thank for clarifications Max

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,250669,250713#msg-250713

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs