Content sync for load balanced web servers
I am currently working on setting up load balancing for a cluster of web nodes with the goal being to move a one node site to multiple load balanced nodes. I wanted to see what method people are using to keep content in sync between the multiple nodes in your cluster.
Without a shared storage solution, the options I see are as follows:
1. Using rsync + cron
This options is not ideal for obvious reasons.
2. Using something like csync2 to keep all nodes in sync with a master node.
3. Setting up one server as an NFS server and having all other web nodes mount over the network. This I imagine would be pretty slow.
So if anyone could give me some insight into how they are doing this and what kind of performance they are getting it would be greatly appreciated. If there is some other option I'm unaware of that would make this ridiculously easy that would be even better!
Thanks!
2 Replies
For example if you have a static site that is updated infrequently rsync works fine, if you have a database driven site then database replication is a good idea, or you can use NFS like the linode library docs suggest.
There's a few docs here
This keeps the servers "read only" (assuming you've got a suitably-redundant set of database servers), and it keeps them pulling code rather than you having to push it.
You can either schedule an update/pull from the repository via cron, or if your VCS is clever enough, have it ssh to your servers and do a pull on commits.
If you're pushing actual content to the servers, the same technique works but you'll go insane in short order. If you aren't using a VCS, you're insane already.