Highly available web host data replication

February 15, 2018 1.4k views
High Availability Load Balancing

Say I have server A and B that are both running a web server + software to detect web server failure. With this basic setup it would claim the elastic IP address whenever the other server is down.

This is all good and well, but how would I go about syncing data between servers? How would I deal with me uploading files to my ‘primary’ web server and have the other servers in the load balancing pool have those files as well?

I know there are possibilities like NFS, but I would like to hear from other, experienced, people how they (would) do this.

Thanks in advance,

1 Answer
  1. Run a continuous rsync between the servers to sync the webserver. There is a article here on how to downgrade your droplet, speaks about a nice way to rsync two servers. You will have to change it to only sync specific directories like webserver, /etc for configuration and certs and whatever else you need. You could potentially sync the database directories, but that is fraught with the risk of inconsistent syncs. Pick point two for this.

  2. Setup MySQL or any other database you use as master and slave on the two machines. Basically, they will always be in sync.

Have another answer? Share your knowledge.