Content sync for load balanced web servers

Hello,

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

It mainly depends on your specific situation.

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 http://library.linode.com/linux-ha/ which might help.

My favorite approach, which works best for application-driven sites where the content is in a database and anything on the app servers is either template or application code, is to checkout/clone the code straight from your repository onto the servers (perhaps following a specific branch or tag, like "production").

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.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct