Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

2 Answers 2

up vote 4 down vote accepted

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.

share|improve this answer
    
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 '12 at 14:31
    
True, I was just going for the simple way of presenting it if the OP decided to use da' Googles. –  Bart Silverstrim May 31 '12 at 14:33

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.