# How to Perfectly Synchronize two Servers---Can rsync do this?



## Hengist (Dec 6, 2010)

I'm sure that this is a very simple question that has been answered many times, but my Google-fu is weak today. I have two servers, one in production and one a backup server. I want to set up a synchronization system where the backup server is always a perfect mirror of the production server, right down to when I install ports on the production server, the updated ports appear on the backup server.

Basically, I want to be able to swap the backup server and production server without changing anything except designating one as the master and the other as the slave.

Is this possible with rsync? If not, could you point me in the right direction on this? Thank you very much for your help.


----------



## jrm@ (Dec 6, 2010)

Unison might do the trick.


----------



## DutchDaemon (Dec 6, 2010)

Which is in ports:

net/unison
net/unison-devel
net/unison-nox11


----------



## Hengist (Dec 6, 2010)

This looks just like what the doctor ordered. I'll give it a look. Thank you both for your help!


----------



## beesatmsu (Dec 6, 2010)

hmm, seems to be nice...do you guys know if it will synchronize mysql database too? I doubt it but it would be cool if it can. I used to use rsync, perhaps time to look at this.


----------



## Hengist (Dec 6, 2010)

Actually, I just checked Unison. It seems I may have spoken too soon. Unison seems to have some trouble with links and with permissions. It would probably make a mess of things if you tried to synchronize a new version of a port on the production server with an old version on the production server. Is there anything more powerful than Unison? It seems that this is a relatively desirable feature to have, so there must be some way to do it.


----------



## Nukama (Dec 6, 2010)

Maybe HAST would be useful?


----------



## phoenix (Dec 6, 2010)

What Nukuma said.  hastd() was made for just this purpose, and it works below the filesystem layer, so the two servers are bit-for-bit identical.  Combine that with carp(4) and devd() and you have a high-availability / transparent fail-over setup using a single shared IP.

Search the forums.  I've posted many links to hast/carp setups and scripts.


----------

