Software download
ocamlopt:http://caml.inria.fr
Unison:http://www.seas.upenn.edu/~bcpierce/unison
1, install unison before installing ocamlopt. Install ocamlopt:
TAR-XVF ocaml-4.02.0.tar.gz
./configure
Make World.opt
Make install
2, installation Unison
TAR-XVF unison-2.48.3.tar.gz
Make Uistyle=text threads=true static=true
After executing the above command, generate a unison file in the current directory.
CP Unison/usr/local/bin
First, configure the dual-machine SSH Trust
A server ip:192.168.6.128
b Server ip:192.168.6.129
1. Perform the following commands on both machines
1) A server with the root user login system, in the root user's home directory to create the. SSH directory and give 700 permissions
mkdir ~/.ssh
chmod ~/.ssh
2) Use the Ssh-keygen command to generate the RAS key for version 2nd SSH protocol
SSH-KEYGEN-T RSA
Generating public/private RSA key pair.
Enter file in which to save the key (/root/.ssh/id_rsa)
Enter passphrase (empty for no passphrase):
Enter same Passphrase again:
Your identification has been saved In/root/.ssh/id_rsa.
Your public key has been saved in/root/.ssh/id_rsa.pub.
The key fingerprint is:
18:19:17:27:47:EA:E8:59:B1:A2:89:E8:0B:A6:85:D1 [email protected]
2. Add the encryption key file to the authorization key file
1) Root User Login
CD ~/.ssh
[email protected]. ssh]# ssh 192.168.6.128 cat/root/.ssh/id_rsa.pub >> Authorized_keys
[[email protected]. SSH] #ssh 192.168.6.129 cat/root/.ssh/id_rsa.pub >> Authorized_keys
SCP Authorized_keys 192.168.6.129:/root/.ssh/
chmod 600/root/.ssh/authorized_keys
2) perform chmod 600/root/.ssh/authorized_keys on the B server
3) Testing
Execute the following command on a, B server
SSH 192.168.6.128 Date
SSH 192.168.6.129 Date
In the first execution, will be asked to enter a password, re-execution without the need to enter a password to display the system log, the SSH mutual trust.
Second, the use of unison
1. Local use of Unison
Unison/data1/data2-batch
#-batch Automatic mode, accept the default operation and execute without human intervention
2, remote use unison
Unison < local directory > absolute path to ssh://remoteip/< remote directory >
Unison/data1 Ssh://[email Protected]//data2-batch
3. configuration file Mode
Modify the configuration file Default.prf (/root/.unison directory)
# Unison Preferences File
Root=/data1
Root=ssh://[email Protected]//data2
#force =/data1
#path =/data1
#path =/data2
Ignore=path web-inf/tmp
Batch=true
maxthreads=300
Fastcheck=true
Owner=true
Group=true
Perms=-1
Sshargs=-c
Xferbycopying=true
Confirmbigdel=false
Log=true
Logfile=/root/.unison/log.log
Repeat=1 #间隔1s重新扫描
Execute Unison DEFAULT.PRF
Unison real-time bidirectional data synchronization