LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-14-2009, 02:12 AM   #1
gilad
LQ Newbie
 
Registered: Mar 2007
Posts: 3

Rep: Reputation: 0
How to have two folders (two machines) constantly synced


Hi,
I got 2 web servers on which I got two web applications.
My goal is to have the "Session" folder and other temp folders constantly in sync between the machine.

I started out using cron and rsync but it's not "real-time" enough as I can only cron every one minute or so.

Can anyone tell me of a smarter way to constantly keep two folders on two machines (same IP cluster) in sync?

Maybe a shell script running always and running rsync?


Thanks,
Gilad.
 
Old 07-14-2009, 02:16 AM   #2
kirukan
Senior Member
 
Registered: Jun 2008
Location: Eelam
Distribution: Redhat, Solaris, Suse
Posts: 1,274

Rep: Reputation: 148Reputation: 148
chek about drbd and heartbeat
 
Old 07-14-2009, 02:18 AM   #3
alexander.i
LQ Newbie
 
Registered: Jul 2009
Location: lg.ua
Distribution: Ubuntu 9.04
Posts: 1

Rep: Reputation: 1
I think you can use sshfs, which allows you to mount remote directory through ssh. So you will have what you want + secure channel
 
Old 07-14-2009, 02:18 AM   #4
eco
Member
 
Registered: May 2006
Location: BE
Distribution: Debian/Gentoo
Posts: 412

Rep: Reputation: 48
Well, if it works by syncing all of it using rsync, then why not invest in a NAS and mount the same web dir on both systems... or start looking into clusters.

Just a thought.
 
Old 07-14-2009, 02:53 AM   #5
gilad
LQ Newbie
 
Registered: Mar 2007
Posts: 3

Original Poster
Rep: Reputation: 0
Thanks guys!
DRBD and hearbeat are an overkill for my needs. The reason I keep two machines is for load balancing mainly (simple round robin).
The heartbeat overhead and HA solution is not my goal and I rather keep it simple.
NAS is a great solution but costs too much to rent.

SSHFS is really cool (never saw it before) but it reads from one machine (while I want both to keep a full copy of the data).

Is there a way to keep rsync running in an ever lasting loop?
 
Old 07-14-2009, 02:54 AM   #6
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,072

Rep: Reputation: 384Reputation: 384Reputation: 384Reputation: 384
I would just mount it remotely, so there's no need to sync.

If you prefer to sync (generating useless traffic and wasting extra storage space), then look into inotify. A simple bash script using inotifywait will be all you need for this. Simple example:

Code:
inotifywait --monitor --event create --event modify --format "%f" ~/tmp | while read file
do
  echo "$file"
done

Last edited by i92guboj; 07-14-2009 at 02:58 AM. Reason: example added
 
Old 07-14-2009, 03:01 AM   #7
EricTRA
LQ Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295
Hi,

I use Unison to my great satisfaction. Easy to setup and configure without any hassle.

Kind regards,

Eric
 
Old 07-14-2009, 05:54 AM   #8
gilad
LQ Newbie
 
Registered: Mar 2007
Posts: 3

Original Poster
Rep: Reputation: 0
Thanks All!
I used SSHFS, worked like a charm!

You guys rock!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
copy folders between machines without password deepika5 Linux - Networking 2 04-24-2008 08:07 AM
Share folders with Windows machines over network furcatus Linux - Networking 2 12-08-2005 11:08 AM
Synced my UX50 mjolnir LinuxQuestions.org Member Success Stories 0 07-07-2005 02:37 PM
flash not synced John5788 Linux - General 0 04-15-2004 12:11 AM
Moving Mozilla mail folders between machines rharvey@cox Linux - Software 6 02-13-2004 09:56 AM


All times are GMT -5. The time now is 02:58 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration