LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-26-2004, 02:37 PM   #1
GuitsBoy
LQ Newbie
 
Registered: Oct 2003
Posts: 26

Rep: Reputation: 15
www mirror: is dnotify / rsync my best bet?


Hi all -

I have twin web servers (FC1) that are pseudo loadbalanced via DNS round robin. I need a way to replicate new content to both servers instantly. So far I have come up with this.

Run at startup:
dnotify -MCDRB /webroot -e /rsync-script &

The /rsync-script will simply propogate changed files from the first webserver over to the second fairly instantaneously, using rsync.

The only thing im uneasy about is having the /rsync-script invoked every time a file is transferred via FTP to the first server. During the transfer of some smaller files, this couldmean the script is run hundreds of times a second. Even If it does run reliably at that speed, I think I may run into problems because dnotify will invoke rsync at the end of every file transfer, yet rsync will attempt to transfer all files that have changed. It is my understanding that dnotify can not specify which individual files have changed in a directory - only that files ave indeed changed, so we cant just transfer them one at a time.

Does anyone else have a more elegant solution to this problem?

Thanks so much,
-Tony
 
Old 01-27-2004, 10:11 AM   #2
GuitsBoy
LQ Newbie
 
Registered: Oct 2003
Posts: 26

Original Poster
Rep: Reputation: 15
TTT
 
Old 01-27-2004, 07:34 PM   #3
lyle_s
Member
 
Registered: Jul 2003
Distribution: Slackware
Posts: 392

Rep: Reputation: 55
I was thinking you could use dnotify to write a timestamp into a file (date +%s > timestampfile) or just use the touch command to update its timestamp. Then, you'd know the last time a file in the directory was changed.

The next step is to have a cron job running that checks the file every so often, and if sufficient time has passed since the timestamp file was updated, run rsync.

One drawback is rsync will run unnecessarily quite a few times.

That's the best I could think of.

Lyle
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
DISCUSSION: Using rsync to mirror data between servers david_ross LinuxAnswers Discussion 8 03-29-2012 01:37 AM
Windows Rsync Upload to Linux Rsync - permissions inspleak Linux - Software 0 10-12-2004 02:49 PM
Rsync to mirror data for backup - having difficulties tapanga Linux - Newbie 1 05-17-2004 05:45 PM
bash script HELP - dnotify > rsync GuitsBoy Programming 5 01-28-2004 09:42 AM
Just bought www.helpwithlinux.net and www.helpwithwindows.com Whitehat General 15 05-08-2003 12:31 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 09:42 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration