| Linux - Server This forum is for the discussion of Linux Software used in a server related context. |
| Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
Due to network maintenance being performed by our provider, LQ will be down starting at 05:01 AM UTC. The exact duration of the downtime isn't currently known. We apologize for the inconvenience.
|
 |
06-16-2011, 03:56 PM
|
#1
|
|
Member
Registered: Dec 2003
Posts: 78
Rep:
|
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
|
|
|
|
06-16-2011, 04:18 PM
|
#2
|
|
Guru
Registered: Jan 2004
Location: NJ, USA
Distribution: Slackware, Debian
Posts: 5,817
|
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.
|
|
|
|
06-16-2011, 04:23 PM
|
#3
|
|
Senior Member
Registered: Dec 2010
Location: Internet
Distribution: Linux Mint, Ubuntu, SLES, CentOS
Posts: 1,674
|
@ 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.
|
|
|
|
06-16-2011, 04:42 PM
|
#4
|
|
Member
Registered: Dec 2003
Posts: 78
Original Poster
Rep:
|
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
|
|
|
|
06-16-2011, 06:44 PM
|
#5
|
|
Senior Member
Registered: Jul 2007
Distribution: Ubuntu 10.10, Slackware 64-current
Posts: 2,046
|
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.
|
|
|
|
06-20-2011, 05:32 PM
|
#6
|
|
Member
Registered: Dec 2003
Posts: 78
Original Poster
Rep:
|
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
|
|
|
|
06-23-2011, 12:05 AM
|
#7
|
|
Member
Registered: Jul 2009
Location: /
Distribution: centos
Posts: 43
Rep:
|
you can use drbd for that !
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 10:50 PM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|