0

This is a higher level, i.e. I just need avenues to explore here, question. I'm trying to set up an NGINX load balancer, behind which sit two different NGINX VPSs. Neither of the backends is a failover, I'm just doing round robining as a way to teach myself some basic load balancing. My question is, how I sync the two backends? How do I ensure that if I upload to wp-uploads on backend1, backend2 also gets the file?

Any high level guidance is great, I'll do the rest. Thanks.

HectorOfTroy407
  • 135
  • 1
  • 5

1 Answers1

0

If you only want to replicate the content from wp-uploads, you could explore the following approaches:

  • Using a distributed filesystem like nfs, glusterfs, ceph, etc
  • Using scheduled tasks (with rsync or zsync) to replicate the content between backends.
  • Nginx has a proxy_store directive which allows to mirror files from remote destinations.
  • Use a remote storage, sending the files through ftp or http and then serve the contents directly from the remote destination. This will require changes on the applications to send the contents.

All approaches have prons and cons and their efficiency will depend on the size of the contents you want to replicate, delay expected, latency between the servers, etc. Also a combination of different approaches is possible like mount a remote filesystem on the backends only to write the files and serve the contents directly from the "storage" server.

hdanniel
  • 4,293
  • 23
  • 25
  • Thank. Will try to run a daemon using rsync on the primary server. When it is updated, it'll sync with the other vps. Cheers. – HectorOfTroy407 Apr 06 '15 at 23:01
  • You can also try `lsyncd`, which monitors for file changes and propagates changes immediately to other node(s) using rsync. – Tero Kilkanen Apr 06 '15 at 23:20