Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I want to get a second server for my site. The first one is currently at my office, and the second one will be at my home (so two different locations so that if the power/Internet goes out, the site is still up).

How do I keep the site files up to date across both servers? Pointing the server at home to the files at my office defeats the whole purpose. If a user adds a file to the first server, how do I get it transferred to the second server?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

From SuperUser http://superuser.com/a/31578

Unison might be a good candidate:

Unison is a file-synchronization tool for Unix and Windows. It allows two replicas of a collection of files and directories to be stored on different hosts (or different disks on the same host), modified separately, and then brought up to date by propagating the changes in each replica to the other.

It already does 2-way syncs. I think you can daisy-chain the 3 machines with 2-way syncs to get what you need. e.g

machines A, B, C => (A <-> B), (B <-> C), (C <-> A)

It's not ideal, but I couldn't find anything better at the moment.

I've learnt that there are very few things rsync cannot do, and it can probably provide an equal or better solution, but you'll have to wait for an rsync expert to turn up for that solution.

Unison can sync more than 2 machines. From their user manual:

Using Unison to Synchronize More Than Two Machines

Unison is designed for synchronizing pairs of replicas. However, it is possible to use it to keep larger groups of machines in sync by performing multiple pairwise synchronizations.

If you need to do this, the most reliable way to set things up is to organize the machines into a “star topology,” with one machine designated as the “hub” and the rest as “spokes,” and with each spoke machine synchronizing only with the hub. The big advantage of the star topology is that it eliminates the possibility of confusing “spurious conflicts” arising from the fact that a separate archive is maintained by Unison for every pair of hosts that it synchronizes.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.