Setting up Unison File Synchronization between two Servers on Debian 10 (Buster) 您所在的位置:网站首页 画展作品信息在哪里看 Setting up Unison File Synchronization between two Servers on Debian 10 (Buster)

Setting up Unison File Synchronization between two Servers on Debian 10 (Buster)

2024-07-13 11:19| 来源: 网络整理| 查看: 265

Setting up Unison File Synchronization between two Servers on Debian 10 (Buster)This tutorial exists for these OS versionsDebian 10 (Buster)Debian 8 (Jessie)Debian 6 (Squeeze)On this page1 Preliminary Note2 Installing Unison3 Creating A Private/Public Key Pair On server14 Running Unison5 Creating a Cron Job for Unison6 Test Unison7 Links

This tutorial shows how to set up file synchronization between two Debian 10 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 server1 will be replicated to server2 and vice versa.

1 Preliminary Note

In this tutorial I will use the following two Debian servers:

server1.example.com with the IP address 192.168.0.100server2.example.com with the IP address 192.168.0.101

I want to synchronize the directory /var/www between the two servers. I will run Unison as the root user in this tutorial so that Unison has sufficient permissions to synchronize user and group permissions.

All commands in this tutorial are run as root user. Login to both servers on the shell as root and start with step 2 "Installing Unison".

2 Installing Unison

server1/server2:

Unison has to be installed on server1 and server2; since we connect from server1 to server2 using SSH, we also need the SSH packages and I'll install the nano editor for file editing on the shell. This can be achieved as follows:

apt-get -y install unison openssh-server ssh nano3 Creating A Private/Public Key Pair On server1

server1:

Now we create a private/public key pair on server1.example.com:

ssh-keygen -t dsa

root@server1:~# ssh-keygen -t dsaGenerating public/private dsa key pair.Enter file in which to save the key (/root/.ssh/id_dsa):  //server2//var/www]Looking for changesWarning: No archive files were found for these roots, whose canonical names are:/var/www//server2//var/wwwThis can happen eitherbecause this is the first time you have synchronized these roots,or because you have upgraded Unison to a new version with a differentarchive format.Update detection may take a while on this run if the replicas arelarge.Unison will assume that the 'last synchronized state' of both replicaswas completely empty. This means that any files that are differentwill be reported as conflicts, and any files that exist only on onereplica will be judged as new and propagated to the other replica.If the two replicas are identical, then no changes will be reported.If you see this message repeatedly, it may be because one of your machinesis getting its address from DHCP, which is causing its host name to changebetween synchronizations. See the documentation for the UNISONLOCALHOSTNAMEenvironment variable for advice on how to correct this.Donations to the Unison project are gratefully accepted:http://www.cis.upenn.edu/~bcpierce/unisonPress return to continue.[] example.com [f]  example.de [f] 



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有