I am trying to setup a 2 way file sync in linux of reasonably small data-set. I would like to replicate data over WAN so distributed filesystems like gluster are not in point of my interest - they are slow (especially reads of lots and small files like php applications). Gluster performance with that kind of storage is awful. And I want use this replication for a webapp hosting solution). I know some mechanisms like lsyncd, incron, the inotify, and ofcource rsync or unison but it is hard to tie them togoether. The hardest part is when there is a bidirectional sync then because of notify systems im sending same files in both directions:A(new files, notified) ---rsync----> B(not new files, but inotify doesnt know so also notifies)B ---rsync same files ---->  AI tried to organize the rsyncs between hosts using a FIFO manner to synchronize but it still isnt the best way because the fifo grows large because of each file notification(like 1000new files = 1000 notification) and those notification are mixed in FIFO from 2 hosts so I cant actually batch them togoether. Most cleanest solution would be to try somehow dig in inotify/lsyncd and make them know that when the monitoring filesystems receive data from rsync or over ssh protocol then it shouldnt send a notify, and when an apache or proftpd is writing then it should send a notify. Having this a simple replication-controller with FIFO for rsyncs and some locking/load distribution system would be good enough to make a reliable 2 way sync solutionHave anyone ever tried to make something like this?
Trying to setup a 2 way file sync in Linux
filesystems;rsync;replication