Highly available web host data replication

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, Arjan


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

  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.