[SOLVED] Synchronizing /etc/hosts files across multiple servers
Linux - ServerThis 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.
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.
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.
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.
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.