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

If I have two web servers, what would the best way to keep their files in sync?

Unfortunately the sites themselves cannot be altered significantly. Most of them are Wordpress based, but there are over 200 of them. There are also some custom sites.

This setup is going from Web server + DB Server to Varnish load balancer + 2x web servers + DB Server. Since Varnish can send requests to either server on a whim, anything like rsync that has more than 10 secs or so lag is out of the question. There is a dedicated private switch for all the servers to use.

I'm thinking against NFS where there is one master copy of the files due to performance and fault tolerance. I want to be able to take any server offline with no problems.

I've tinkered with ChironFS before which is a FUSE file system which does RAID 1 at a file level. It would be tied with NFS for the networked aspect. Pros are it is quick and can scale easily to a small number of servers. A con is it is a little bit of a handful since you need to use NFS as well.

I've also heard of Unison but I've never tried it before. It is user level so I'm not sure how robust it is or what kind of sync lag there would be.

Are there any other options I haven't seen?

share|improve this question
    
If you used a single NFS server, you'd still have a serious single point of failure. –  mdpc Mar 7 '12 at 23:22

3 Answers 3

up vote 2 down vote accepted

GlusterFS? You would have both web servers as gluster servers (say, exporting /srv/export), and also acting as gluster clients, mounting the same exported volume (say, moutning /srv/share). File operations would be on /srv/share and would propagate to all boxes in the cluster.

share|improve this answer
    
Thanks. I'll check out GlusterFS as well. –  Nick Mar 8 '12 at 20:42

Well, unison's just rsync with selectable diffs, so that's out. I'd stick with NFS, myself -- it's about as robust and reliable as any other option, and at least it's battle-tested with a lot of knowledge out there "on the tubes", and you can make it HA if you need reliability. All the other options for a shared filesystem are either very "niche", hideously unreliable, hideously unperformant, or a mix of all three.

share|improve this answer

Are there any other options I haven't seen?

You can use a cluster file system like OCFS2. The web nodes can mount the OCFS2 file-system using iSCSI for example. The OCFS2 filesystem is on a LUN on a SAN with redundant shelves.

Non-trivial to setup but solves the problem you specify.

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.