LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 06-02-2011, 07:10 PM   #1
fancylad
Member
 
Registered: Mar 2008
Distribution: slackware
Posts: 175

Rep: Reputation: 19
how to force nginx to do DNS lookups


Does anyone know if there is a way to get nginx to perform DNS lookups at regular intervals against hostnames that are defined for upstream servers? It seems nginx only performs a DNS lookup once, the first time it starts, and subsequently does not perform any other DNS lookups. This causes problems when the ip addresses of our upstream servers change.

I posted this same question in the nginx forum; however I also posted it here as it seems that not many of the posts there get answered.

http://forum.nginx.org/read.php?15,203481
 
Old 06-03-2011, 02:42 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Hi,

I guess you can use in nginx.conf
Code:
resolver x.x.x.x;
where x.x.x.x is the IP of a dns server that is aware of the changes in the upstream servers IPs.

Regards
 
Old 06-03-2011, 10:43 AM   #3
fancylad
Member
 
Registered: Mar 2008
Distribution: slackware
Posts: 175

Original Poster
Rep: Reputation: 19
Thanks for the suggestion but I already tried that and it doesn't change the behavior. It only sets the nameserver nginx queries the first time it is started.
 
Old 06-05-2011, 03:47 AM   #4
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Yes, but according to Igor Sysoev (nginx author), cache should expire every 5 mins. See this post on the matter.
So unless upstream servers change ip addresses in less that 5 mins, you should not have a problem.
 
Old 06-05-2011, 09:12 PM   #5
fancylad
Member
 
Registered: Mar 2008
Distribution: slackware
Posts: 175

Original Poster
Rep: Reputation: 19
Thanks. His post in your link does seem to suggest that the cache expires after 5 mins but that is definitely not the case.
 
Old 06-06-2011, 12:43 AM   #6
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Are you sure it's not the resolver you're using, that is not aware of the IP changes of the upstream servers?
You may install a lightweight resolver (like dnsmasq) locally and tune its cache to your liking

Regards
 
Old 06-06-2011, 01:01 AM   #7
fancylad
Member
 
Registered: Mar 2008
Distribution: slackware
Posts: 175

Original Poster
Rep: Reputation: 19
Yes I'm 100 percent sure it's not the resolver. This is how nginx works, at least by default.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Slow DNS Lookups JustinK101 Linux - Software 1 01-29-2007 06:48 PM
sendmail dns lookups davidsrsb Linux - Networking 1 06-09-2005 09:35 PM
DNS Lookups Slow kwiksand Linux - Networking 0 11-15-2004 04:52 AM
Allow DNS lookups through ipchains? ifm Linux - Security 4 08-09-2002 08:17 AM
Reverse DNS Lookups ascii2k Linux - Networking 2 08-08-2001 09:01 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 12:50 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration