Linux – Keep Uploaded Files in Sync Across Multiple Servers – LAMP

centoslinuxMySQLPHPsynchronization

I have a website right now that is currently utilizing 2 servers, a application server and a database server, however the load on the application server is increasing so we are going to add a second application server.

The problem I have is that the website has users upload files to the server. How do I get the uploaded files on both of the servers?

I do not want to store images directly in a database as our application is database intensive already.

Is there a way to sync the servers across each other or is there something else I can do?

Any help would be appreciated.

Thanks

Best Answer

This is difficult to answer because it's entirely dependent on your application. It sounds like you have some core application architecture issues that won't be resolved in a ServerFault question. With that said, there are some steps you can take to resolve the issue you described.

The most appropriate course of action in a situation like this is to break the file share into a separate service of its own. Don't duplicate files if you have a network that can let the files be "everywhere (almost) at once." You can do this through NFS/CIFS or through a proper storage protocol like iSCSI. Mount as local storage in the appropriate directory. Depending on the performance of your network and your storage needs, this could add a couple of undetectable milliseconds to page load time.

Related Topic