Deploying the Unison bidirectional Synchronization Service in CentOS 6.5

Source: Internet
Author: User
Tags ocaml

Deploying the Unison bidirectional Synchronization Service in CentOS 6.5

Deploying the Unison bidirectional Synchronization Service in CentOS 6.5

Environment Introduction:

ServerIPServer1192.168.30.131Server2192.168.30.132

1. Add host mutual trust:

A. Add the host file (in Server1 and Server2 respectively ):

[Root @ localhost ~] # Echo-e "192.168.30.131 Server1 \ n192.168.30.132 Server2">/etc/hosts

B. Change the host name (in Server1 and Server2 respectively ):

[Root @ localhost ~] # Sed-I "s/HOSTNAME =. */HOSTNAME = Server1/g"/etc/sysconfig/network

[Root @ localhost ~] # Hostname Server1

  C. log out and log on again. The host name is displayed.

  D. Add mutual trust

D1:

[Root @ Server1 ~] # Ssh-keygen-t rsa

[Root @ Server1 ~] # Ssh-copy-id-I/root/. ssh/id_rsa.pub root @ Server2

D2:

[Root @ Server2 ~] # Ssh-keygen-t rsa

[Root @ Server2 ~] # Ssh-copy-id-I/root/. ssh/id_rsa.pub root @ Server1

  

2. Unison Installation

Various unison versions:
Http://www.seas.upenn.edu /~ Bcpierce/unison // download.html
Unison Compiler:
Http://caml.inria.fr/pub/distrib/ocaml-3.10

    

    2.1 install the compilation tool: Objective Caml compiler

[Root @ Server1 soft] # cd ocaml-3.10.2 + rc1/

[Root @ Server1 ocaml-3.10.2 + rc1] #./configure

[Root @ Server1 ocaml-3.10.2 + rc1] # make world opt

[Root @ Server1 ocaml-3.10.2 + rc1] # make install & echo OK

    

    2.2 installing Unison:

[Root @ Server1 unison-2.13.16] # cd ../unison-2.13.16

[Root @ Server1 unison-2.13.16] # make UISTYLE = text THREADS = true

An error occurs:

/Bin/sh: etags: command not found

Make [1]: [tags] Error 127 (ignored)
Make [1]: Leaving directory '/soft/unison-100'

Solution:

Yum-y install ctags-etags

Re-compile:

[Root @ Server1 unison-2.13.16] # make UISTYLE = text THREADS = true

[Root @ Server1 unison-2.13.16] # make install & echo OK

If the following error is reported:

Mv/root/bin // unison/tmp/unison-10301

Mv: cannot stat '/root/bin // unison': No such file or directory
Make: [doinstall] Error 1 (ignored)
Cp unison/root/bin/
Cp: cannot create regular file '/root/bin/': Is a directory
Make: *** [doinstall] Error 1

Solution:

[Root @ Server2 unison-2.13.16] # mkdir/root/bin

[Root @ Server2 unison-2.13.16] # cp unison/root/bin/

Re-compile:

[Root @ Server1 unison-2.13.16] # make install & echo OK

    

    2.3 modify the configuration file;

[Root @ Server1 data] # cat/root/. unison/default. prf

# Unison preferences file
Root =/data
Root = ssh: // root @ Server2 // data
# Path = www
# Ignore = Path wp-content/tmp
Ignore = Path wp-config.php # ignoring wp-config.php files is equivalent to rsync's exclude
# Nodeletion =/data
Batch = true
Maxthreads = 300
# Repeat = 1
Owner = true
Group = true
Perms =-1
Fastcheck = false
Sshargs =-C
Xferbycopying = true
Log = true
Logfile =/tmp/unison. log

    2.4 create a synchronization directory/data

[Root @ Server1 ~] # Mkdir/data

[Root @ Server1 ~] # Echo "aa"> aa.txt

    

    2.5 The steps above the same operation on Server 2 are skipped here

    

    2.6 test Synchronization

[Root @ Server1 ~] # Unison-servercmd

[Root @ Server1 data] # unison-servercmd =/root/bin/unison
Contacting server...
Looking for changes
Waiting for changes from server
Reconciling changes

Local Server2
New file ----> bb.txt
Local: new file modified on at 14:42:45 size 5 rw-r -- user = 0 group = 0
Server2: absent
Propagating updates


UNISON started propagating changes at 14:43:10 on 19 Aug 2015
[BGN] Copying bb.txt
From/data
To // Server2 // data
[END] Copying bb.txt
UNISON finished propagating changes at 14:43:10 on 19 Aug 2015


Saving synchronizer state
Synchronization complete (1 item transferred, 0 skipped, 0 failures)
[Root @ Server1 data] #

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.