If it were me I'd look at making something based on ionotify
Then scp the files between the servers.
(note you will need to check the remote side to see if the file exists so you don't make a loop)

Upside is there's no 5 minute window.
I'd keep the rsync as well but run it much less often, mainly as a belt and suspenders option to keep the files in sync.

Otherwise cheat.
If the load isn't high (and the use of rsync implies it isnt) just mount from one to the other over something like sshfs(bad but easy) or nfs (better). Perhaps put an rsync push from the "file server" to the "backup system" for "backup" purposes (or again ionotify).


On 14/05/13 09:16, DaZZa wrote:
Learned ones!

To overcome some crappy web design (two servers, load balanced, no
shared storage), I need to implement rsync to synchronise a directory
between two servers.

Trouble is, it's got to be a two way sync.

I.E. File uploaded to web server 1 (don't ask - I told you it was crap
web design) needs to be available to download from web server 2 if
necessary for future sessions - I.E. I've got to copy the file from
server 1 to server 2 in short order (sub 5 minutes).

I've ALSO got to do the same from server 2 back to server 1 - so if
the incoming upload goes to server 2, it's got to be copied back to
server 1.

Currently, I've got rsync running on both servers every 5 minutes and
synchronising files from 1 to 2, and from 2 to 1. I'd like to just do
this in once process - run rsync on server 1, have it connect to
server 2 and pull/push all files until the directories match.

I don't know if this is even possible with rsync - and if so, I don't
know the options required to make it work.

The current command being used is

rsync -v -rlt <directories>

Can anyone suggest a better option set which could make this a two way
sync by just running on the one server?

Thanks.

DaZZa

--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to