[Cialug] instant replication with rsync
djweis at internetsolver.com
Tue Jan 13 11:59:30 CST 2009
Matthew Nuzum wrote:
> On Tue, Jan 13, 2009 at 11:46 AM, Jeffrey Ollie <jeff at ocjtech.us> wrote:
>> On Tue, Jan 13, 2009 at 11:37 AM, Matthew Nuzum <newz at bearfruit.org> wrote:
>>> Is there a way to use rsync (or a similar tool) to get near instant replication?
>>> Scenario, you have a website that allows users to upload images. Files
>>> are uploaded several times per day at unpredictable intervals. You
>>> want the images to appear instantly regardless of which webserver they
>>> were uploaded on.
>>> Setting rsync to run at 1min intervals would not do this because if
>>> you upload an image you want to see it right away. Also, on a busy day
>>> there may be 10 - 20 images uploaded. If you have multiple servers
>>> running rsync at one min intervals it would be a bit wasteful.
>> I would either push the images from the upload server to the rest or I
>> would trigger a pull using some lightweight mechanism like an xml-rpc
>> call or something like that.
> Yes, that seems like a good way. I'm a web programmer so I could
> imagine a system where an event occurs that I can trap and run a
> processes on. onchange="..." or ondelete="..." Is there a way to cause
> things to happen when certain events occur? I seem to remember a
> feature from SGI that notified applications when the fs changed. That
> was years ago and seems like there'd be lots of good uses for that, so
> certainly it's common now, right?
I believe you can do a select() on a directory and when it returns to
you something has changed in the directory. I don't know/think it's
recursive however. I think the other suggestions were more like do a
system() call inside your website post-upload.
Your Technology Partner
More information about the Cialug