Unison bidirectional Sync Tool uses

Source: Internet
Author: User

Unison Introduction

Rsync data mirroring is a single item, and the client is only kept in sync with the server, and when the client adds or deletes some files, it does not sync to the servers side. and Unison can complete bidirectional synchronization, any one end of the data changes, will be updated to the corresponding end. Unison is developed using the OCaml language, and the two ends are updated to a consistent state by comparing the files on both ends based on the rsync algorithm.


Unison characteristics

    • Cross-platform

    • Two-way synchronization, automatic update of two copies there are no conflicting parts, conflicting parts are selected by the user to update the policy

    • Support for incremental synchronization, the file status is logged each time the synchronization is complete, and the next time synchronization, the last state as the starting point for synchronization



Installing unison


The first thing to install is OCaml

# CD ocaml-4.02.1

#./configure

# make World opt

# make Install

# CD unison-2.48.3

# Make Uistyle=text threads=true

Error occurred:

Which:no Etags in (/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/java/latest/bin:/usr/local/ Tomcat/bin:/root/bin)

/bin/sh:line 1:etags:command not found

MAKE[1]: [tags] Error 127 (ignored)

MAKE[1]: leavingdirectory '/unison/unison-2.48.3 '

Workaround:

# yum Install Ctags-etags

# Make Uistyle=text threads=true

Copy the unison command to a path path

# CP Unison/usr/local/bin

The unison command uses


    • Synchronizing two directories for one host

# Unison/test1/test2

    • Remote synchronization

Unison < local directory > ssh://remote_ip/< absolute path >

# Unison/test1 Ssh://192.168.1.13//test2

    • Unison parameter Description

  1. TestServer

    Test connectivity, connect to the server and exit

    unison/ssh://[email protected]/-testserver

  2. Servercmd

    Tell unison what the server unsion command is

    unison/ssh://[email protected]/-testserver-seervercmd=/usr/local/bin/unison

  3. Auto

    Receives the default action, waits for the user to confirm whether the execution

  4. Batch

    Fully automatic mode, accept the default action and execute

  5. Ignore

    Ignore XXX

    Directories or paths that are ignored when synchronizing

  6. IgnoreCase

    Whether to ignore file name capitalization

  7. Follow

    Follow xxx

    Whether to follow the symbolic link

  8. Patch

    Patch XXX

    Synchronizes only the specified directories and files, not the entire directory, and can be specified multiple times

  9. Owner Group

    Synchronization belongs to the main genus Group

  10. perms =-1

    Keep Read and Write permissions

  11. Repeat

  12. Retry

  13. Sshargs =-C

  14. Xferbycopying

  15. Immutable xxx

    Specify a directory that does not change, ignoring when scanning

  16. Slient

    Silent mode

  17. Times

    Synchronization modification Time

  18. Masthreads N

    Maximum number of threads

  19. Rsync

    Default ture, activate rsync transfer mode

  20. Log

    Record log

  21. LogFile

    Log file



Using Unison with configuration files


Synchronizing the/www/mingxiao directory of native and 192.168.1.13

First, the confidential and 192.168.1.13 two-machine mutual trust, the specific method no longer write


Vim/root/.unison/ixbda.prf

root = /www/mingxiao   #要同步的文件夹root  =ssh://[email protected]//www/mingxiao # To synchronize the folder #force = /www/mingxiao   #以本地文件为标准, sync the directory to the remote host, turn it on and turn it into a single synchronization Path = web1path  = web2  #只同步 Web1 and WEB2 directories under the/www/mingxiao directory ignore = path tmp  #忽略同步/www/ Mingxiao/tmp Directory #prefer =ssh://[email protected]//www/mingxiaobatch = true   #全自动模式 , accept and execute the default action maxthreads = 300  #同步时最大线程数repeat  = 1  #间隔一秒后, start a new sync check retry =  3  #重试次数owner  = truegroup = trueperms = -1  #保持同步过来读写权限sshargs  = -C  #使用ssh压缩传输方式  perms = -1fastcheck = false # True indicates that the files are compared between the two files at the time of synchronization, and if False, the contents of the two files are compared. Suggested truersync = false#debug = verbosesshargs = -cxferbycopying =  trueconfirmbigdel = false  #默认值是true, indicating that when one of the two directories that need to be synchronized is empty, Unison will stop and this is set to false, even if the empty unison does not stop running log  = truelogfile = /tmp/unison.log 


# unison Ixbda to start syncing

This article is from the "on the Road" blog, please be sure to keep this source http://mingxiao.blog.51cto.com/8124243/1675361

Unison bidirectional Sync Tool uses

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.