LinuxQuestions.org
Review your favorite Linux distribution.
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-16-2011, 04:56 PM   #1
blainemiller
Member
 
Registered: Dec 2003
Posts: 78

Rep: Reputation: 1
Synchronizing /etc/hosts files across multiple servers


Hello,

I have 16 linux servers that use /etc/hosts files to see and talk with each other. I'm adding servers to this pool of servers.

It is required to do host resolution via the /etc/hosts files. DNS or NIS are not alternatives.

Aside from manually editing each of the 16+ /etc/hosts files every time I add a server or editing one /etc/hosts file on one server then scp'ing it to all the other servers, is there anyway to edit the /etc/hosts on one server and "push" it onto the other servers that need the new /etc/hosts file?

Everywhere I've looked on the Net, there hasn't been any suggestion except for the options I mention here.

Or am I just whistling in the wind?

Thanks for your time and consideration.

Blaine Miller
 
Old 06-16-2011, 05:18 PM   #2
MS3FGX
Guru
 
Registered: Jan 2004
Location: NJ, USA
Distribution: Slackware, Debian
Posts: 5,852

Rep: Reputation: 351Reputation: 351Reputation: 351Reputation: 351
I can't say I get the difference between using SCP to transfer the files to the destination servers and "pushing" it. What would you consider pushing to the remote machines if not transfering the file?

If it is an issue of effort, it would be no problem to script the SCP action so that it is done automatically without having to run the command 16 times.
 
Old 06-16-2011, 05:23 PM   #3
T3RM1NVT0R
Senior Member
 
Registered: Dec 2010
Location: Internet
Distribution: Linux Mint, Ubuntu, SLES, CentOS
Posts: 1,790

Rep: Reputation: 324Reputation: 324Reputation: 324Reputation: 324
@ Reply

Hi Blaine,

You can try this: http://www.howtomonster.com/2007/08/...automatically/

Pretty similar to scp'ing way you mentioned.

I am not aware of any other way of synchronizing /etc/hosts other then the above mentioned two methods.

You can create a cron job to run every hour on the source server to push updated /etc/hosts file to destination server.
 
Old 06-16-2011, 05:42 PM   #4
blainemiller
Member
 
Registered: Dec 2003
Posts: 78

Original Poster
Rep: Reputation: 1
Great! Thanks, T3RM1NVT0R...

I agree about the solution presented on the site you included with your post. It is pretty similar to scp'ing the file over.

And I was afraid you'd say that about there not really being any other way to make changes to the /etc/hosts file propagate out to the other servers.

This really was a problem fixed when DNS was created. I'm lobbying for adding DNS resolution myself, but our Dev Director won't approve it till it's been tested.

Thanks!

I'll mark this as solved and closed...

Blaine
 
Old 06-16-2011, 07:44 PM   #5
Noway2
Senior Member
 
Registered: Jul 2007
Distribution: Ubuntu 10.10, Slackware 64-current
Posts: 2,124

Rep: Reputation: 776Reputation: 776Reputation: 776Reputation: 776Reputation: 776Reputation: 776Reputation: 776
Quote:
but our Dev Director won't approve it till it's been tested.
Until DNS solution over a hosts file has been tested? Tell your Director to read the history of the Internet. DNS (BIND) was invented because managing hosts files became unmanageable over multiple hosts. Do they have a particular hang up or question that we might be able to help address? DNS was designed for this very purpose.

In the mean time, I might suggest putting the master host file in a centralized location and then creating a cron task to synchronize among the various hosts. SCP would work, as would rsync. By setting it up as a cron task, you would guarantee that updates were propagated regularly. Given the what I presume to be the limited (small) size of the hosts file, you could even have it synchronize often without ill effect to your network.
 
Old 06-20-2011, 06:32 PM   #6
blainemiller
Member
 
Registered: Dec 2003
Posts: 78

Original Poster
Rep: Reputation: 1
I agree about the Dev Director... He's pretty lame... But I'm just the flunky that has to find some way of implementing things he proposes we do in his lame way.

I like the idea of syncing the files from a central location with a crontab entry. I'm going to keep the suggestion under my hat in case my *grand scheme* fails. That scheme being to force this lame Director into good practices, like using the right tools for the job, like using DNS for the purpose it's meant to be used for.

Like I said, I do well appreciate your well meant question. Your alternative is very elegant.

Blaine
 
Old 06-23-2011, 01:05 AM   #7
hhh123
Member
 
Registered: Jul 2009
Location: /
Distribution: centos
Posts: 47

Rep: Reputation: 1
you can use drbd for that !
 
  


Reply

Tags
hosts, resolve


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Synchronizing 2 servers bucovaina78 Linux - Server 4 09-07-2010 06:20 AM
Multiple hosts not seeing each others files even though LUN is same abylin1 Red Hat 1 01-11-2008 08:46 AM
Multiple addressing through hosts files Slick666 Linux - Networking 3 07-25-2006 10:10 AM
Synchronizing Users Across Multiple Servers ghight Linux - Networking 4 08-22-2003 10:35 AM
Software for synchronizing files on web servers josephswagner Linux - Software 2 02-06-2003 01:13 AM


All times are GMT -5. The time now is 04:31 AM.

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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration