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 |
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. |
@ 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. |
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 |
Quote:
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. Blaine |
you can use drbd for that !
|
All times are GMT -5. The time now is 03:51 PM. |