1

I'm looking for some bidirectional data synchronization between the web nodes. I've got two web servers with DNS load balancing. I'm using "lsyncd" at the moment however because of load balancing feature when I add some content (files, images) on the node B it's not replicated to the node A. Is it possible to use rsync (lsyncd) so it will sync the files in both ways?

2 Answers 2

4

You could look at a filesystem like DRBD that will automatically sync a mounted volume over the network, kind of like a networked RAID mirror set. Depending on your specific needs you might have to set this up as a cluster with heartbeat to make sure you avoid split brain situations, but it might be the best way to set up bi-directional syncing for independent systems.

Otherwise you could work out some form of scripted RSync, but you may run into race conditions or weird file access anomalies.

The last option I know of would be to have a file server in the back end that both web servers mount so there is actually one file store, or some other shared storage server solution using fiber channel or iscsi.

2
  • DRBD is not really a filesystem, but a replicated block device. A cluster filesystem (e.g. OCFS2) will be needed on top of DRBD in order to get a replicated filesystem.
    – Oliver
    May 31, 2012 at 14:31
  • True, I was just going for the simple way of presenting it if the OP decided to use da' Googles. May 31, 2012 at 14:33
4

Yes, rsync will do handle this (run at both ends with -u flag) or just use unison. However for a managed deployment process, the file copying should run in one direction only.

Better yet, use a distributed cluster file system like AFS

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .