多个Web服务器机器+ 1个DB服务器 - 如何处理上传的文件同步?

we have 3 webservers (apache + PHP) on three different machines, talking to a database machine. Our application allows users to upload their own images. The uploaded images are stored and mapped to a local drive on the machines. Let me first admit that we never engineered our application to be distributed. In tha above scenario, what we see is that the images are uploaded and stored on one server and are not available to the others.

What is the current state of the art for upload content - is it something like S3 or exporting a file system over NFS (security issues ?), or is it something like an image server which allows you to do that ?

We just map shared drives on our SAN. CDN's are also a viable option. You just need shared disk space somewhere. Whether that is in the 'cloud', or on a SAN, or a simple shared network drive somewhere.. it doesn't matter.

Here are just a few of many solutions:

  1. Storing them in a Database
  2. Separate server, with Varnish/Squid in front. (in-memory cache) you can use rsync or some other tool to keep this up to date.
  3. A CDN (although, i'd combine it with #2)

Mix and match!

This may be overkill for you.. but this is how Facebook do it: http://www.facebook.com/note.php?note_id=76191543919