Comments on Setting up Unison File Synchronization between two Servers on Debian 8 (Jessie)

This tutorial shows how to set up file synchronization between two Debian 8 servers with Unison. Unison is a file-synchronization tool similar to rsync, the big difference is that it tracks/synchronizes changes in both directions, i.e., files changed on Server 1 will be replicated to Server 2 and vice versa.

10 Comment(s)

Add comment

Please register in our forum first to comment.

Comments

By: Luis Giovanny

Thanks you !! , Great post. 

I am set up load balancing with nginx LB (node 1)  and 2 node (Nginx web servers, PHP-FPM, Drupal 7, mysql cluster).

unison sync for Drupal's file beetwn two web servers. 

Thanks.

 

By: Rob

Does not work with "The Perfect Server - Debian 8 Jessie (Apache2, BIND, Dovecot, ISPConfig 3)"

By: Kevin Bodson

Hello,

i would like to know something. I just enter in the company and i'm new with unison_sync.

Unison was already set up in the company but they made some changes and now i need to update the unison sync for some folder.

 

So here is my problem :

I just would like to sync 2 folder like var/www/pdf on server 1 and var/www/pdf on server 2.

I don't know why but when i put a file e.g. (test1)  on the server 1 and then use unison_sync, he is working fine and put test1 into the /var/www/pdf on the server 2.

But if i put a file on the /var/www/pdf on the server 2, when i use unison, he doesn't copy my file from the server 2 to the server 1 ... he DELETE it!

 

Why ? there is a special parameter to do this ?

Into a configuration file, i have this line : # Use this command for displaying diffsdiff = diff -y -W 79 --suppress-common-lines

What are the parameters -y and -W and --suppress-common-lines ?

Thanks in advance.

Regards,

Kevin.

By: SamTzu

Almost perfect :)

You missed 2 things:

1) It should be rsa instead of dsa

2) /etc/init.d/cron restart

By: Fernando Garcia

Thanks! it works.

However, a few things.

1.      The key need to be RSA (at least in Ubuntu Server, which is what I was using).

2.      If the ssh port is different, one will need to use the -p as ssh-copy-id -i $HOME/.ssh/id_dsa.pub [email protected] -p 2222

3.      Also, add the port in: ssh-copy-id -i $HOME/.ssh/id_dsa.pub [email protected]:2222

 

4.      If you have a firewall or Fail2ban installed, make sure this services are not blocking your SSH transactions.

By: vlad

And what is the difference between unison and rsync?!

I preffer rsync:)

 

By: till

Rsync is a nice program and I use it regularly, but unison is different and has features that rsync does not provide. Unsion is a two way sync while rsync can only sync in one direction, so unison is used when you have situtaions where files get changed or added on both nodes.

By: Eric

Hello, I use my Raspberry Pi (Raspbian) as a NAS and want to synchronize it with my Linux Mint laptop. It works perfectly with unison and a RSA key when I call it through the GUI or the command editor. But it always fails when called by CRON : Fatal error: Lost connection with the server. Got any clue about it ?

By: Szczepan Ho?yszewski

Is it possible to configure unison to be boldly noninteractive for all current and future roots? I really want it to use it in a scripted scenario without having to provision unison configuration for each and every website directory!

By: till

Yes, that's what the above guide describes. See the second part of chapter 4 and chapter 5.