Sync WordPress Media

If you’re in a position where you’re running a cluster of servers such as a primary/secondary or primary/primary. You will need a method to sync the wp-content/uploads folders to all of the hosts involved in your cluster. The following are tools that can accomplish this task.

DRDB

NFS

Wouldnt this be an issue for the entire web-app directory, not just media uploads? If plugins or themes are changed, the files change. Of course, you probably need to have that already handled if you have a horizontally scaled site via git deploys or docker images etc…

Anyway, a more appropriate solution for media is just to use one of many existing plugins to offload your media to an external storage provider (s3, backblaze, etc…) and then all references to that file in the html will point to something like cdn.site.com. Solves the problem completely.

1 Like

Yes, you would need to consider how you manage your codebase for your site. You could also sync the entire code base too if you wanted.

Usually git hooks etc.

Yes, this is actually a great method. However if you don’t care to offload, you can always do the traditional syncing using NFS etc. Or even deploy your own S3 instance using Minio.