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 setting up a cluster of three apache servers and I can't find much information on how to best handle a shared document root. Currently I was planning on building a dedicated file server and share the website source over NFS. Then each apache machine would mount that NFS directory and serve the PHP files from out of there.

The only alternative I can think of to NFS is to rsync the source files between each server, but that seems messy.

My question is what is the best way to handle sharing website source code between multiple load-balanced apache servers?

Thanks!

share|improve this question
    
What happens when the server hosting your docroot goes down? –  LukeR Oct 3 '10 at 22:55
    
That's a potential problem. That's why I'm trying to find a better solution. :) –  Harry Oct 3 '10 at 23:26
add comment

2 Answers

up vote 1 down vote accepted

I would actually recommend something more along the rsync lines you were considering. For a fairly static set of files (like a website docroot), this setup works quite well. Getting into distributed filesystems (OCFS2, GFS2) or NFS is going to add additional points of potential failure, present potential performance problems, and significantly increase the complexity of the setup. On top of that, most distributed filesystem setups require (expensive) SAN hardware to share disks (unless you're using something like DRDB, which I'm not sure would work well for your setup).

I would setup one server (it can have minimal resources, or even be virtual) as your production staging server. Configure it exactly as your production webservers will be, and any production changes are made there. Then, put together a set of scripts (possibly/probably using rsync or an analog) that will push your web root from the staging server to all of your production servers.

Another possible setup is to store your webroot in your favorite source code revision control system (which you should be doing anyway), and have the three production servers pull the document root directly from the repository.

share|improve this answer
add comment

Sounds like you might want a distributed file system

http://en.wikipedia.org/wiki/List_of_file_systems#Distributed_file_systems

I had a Grid project and we had to built a compute cluster and decided to use OpenAFS which is the only one I know. It kinda sucks from a learning point of view cause its not easy imo.

However that link I posted has a list of them. Some support replication and striping (fault tolerant and parallel. Just research those and pick one that you like).

share|improve this answer
add comment

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.