I'm moving from a single server to a multi-server setup (all RHLinux), and I'm trying to figure out how to solve what should be a fairly common problem. Users can upload files to my website (think pictures for a user profile), which should be accessible to everyone regardless of which server was used to upload them, and which server the viewer is on. Up until now, these files have been stored in a specific directory on the one server - but now, if user A uploads a file F on server App1, and user B happens to be on server App2, then user B won't be able to access the file because App2 will look for it and not find it in its local directory.
Is there a standard solution to this problem? Ideally, I'd be able to set up directories on my N servers that automatically synchronize, or that are shared between the servers, but I'm pretty much open to any suggestions. Thoughts?
This feels like a good start - I could certainly keep a list of hosts, and then spin off N-1 rsync calls (on individual files) immediately after an upload (it's important that things be available immediately - otherwise the database has to become more complex, and remember where things are, when)... There are 60k+ files in these directories (new files get added, but old ones never change), so doing full copies feels like it would be a bit prohibitive.