0

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!

Harry
  • 221
  • 1
  • 5
  • 9

2 Answers2

1

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.

Christopher Cashell
  • 9,128
  • 2
  • 32
  • 44
0

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).

PHGamer
  • 430
  • 1
  • 4
  • 7