in reply to Writing to a file on two different servers

There are many ways of solvingh this problem, some of them may be restricted sue to system of network configuration. Some methods are more convenient, but less secure.

NFS or Samba, etc. Depending on whether or not your machines are of the same type, it may be easy enough have file system shared between the two machine. You may have a problem if the servers are part of some High Availablility system. Having one disk with confif files on makes a single point of failure, which rather defeats the point of HA. If this is the case, some careful cross-mounting will have to be done. Also, some method of recognising that the other server has gone away, before an IO hang is initiated by trying to access a file which is on a mahcine which is no longer in operation. The beauty of this method is that your code does not have to change. The method for opening files remains the same.

FTPGood old, file transfer. This can be acheived with Net::FTP and makes for a very easy method of transfering file. Obviously, you'll have to write a file, transfer it and then possibly delete it. There are tons of examples of how to do this kicking about. Watch out for such things as file permissions and other oddities, as your FTP server may have some interesting configs which will mean you may have to change things, post transfer.

HTTPAs your config file is servable from your HTTP server (which is a little insecure), you may wish to transfer the file using this method instead of FTP. The problem you may find here is that you are not able to "PUT" files with your current config. This is, in fact, a good idea if you are serving config file.

--
Brother Marvell

  • Comment on Re: Writing to a file on two different servers