Rsync installation and configuration under Linux

Source: Internet
Author: User
Tags diff tmp folder rsync

Rsync (synchronous data, support incremental backup)

How to use:

Rsync-av 192.168.31.182:/tmp/1.txt/tmp/(Copy the 1.txt file under the TMP folder in Server 192.168.31.182 to the TMP directory on this machine)

Rsync-av/tmp/1.txt 192.168.31.182:/tmp/(Copy the 1.txt file from the local TMP directory to the TMP folder in the server 192.168.31.182)

Rsync-av 192.168.31.182::longfei/123/1.txt/tmp/(Demo copy from server to local)

Rsync-av/tmp/1.txt 192.168.31.182::longfei/123/(demo copied from local to server)

Options:

-A = =-rlptgod

-V = = Visualization

--delete = = A-->b Delete a file that does not have B during synchronization

--exclude=pattern = = Some folders are not synchronized during synchronization

-P = Ability to view synchronization progress, similar to-V

-U = = A-->b Avoid overwriting the modified file contents on the B machine

-avl (can copy files with soft links directly)


Rsync-av 111//tmp/123/(copy files under 111 directory to/tmp/123/)

Rsync-avl 111//tmp/123/(the file that has the link of the soft link file directly overwrites the copy to the corresponding file under/tmp/123/)

Rsync-avl--delete 111//tmp/123/(will have the link file of the soft link file directly overwrite the corresponding file under the/tmp/123/, and the original folder deleted files, also deleted in the target folder)

Rsync-avlu 111//tmp/123/(a linked file with a soft-linked file is overwritten directly with the corresponding file under/tmp/123/and will not overwrite the modified file in the destination folder)

Rsync-avlu--exclude= "*.txt" 111//tmp/123/(the file that has the link to the soft link file is overwritten directly to the corresponding file under/TMP/123/, and the file that has been modified in the destination folder is not overwritten, But do not copy all the. txt end files in the original folder)

Rsync-avlupz--exclude= "*.txt" 111//tmp/123/(the file that has the link to the soft link file is overwritten directly to the corresponding file under/TMP/123/, and the file that has been modified in the destination folder is not overwritten, But does not copy all the. txt end files within the original folder, and displays the current copy progress and compresses the copy content for transmission)

Rsync-avpz-e "Ssh-p 10022" 192.168.31.182/tmp/111/./111/(Specify port for copy transfer)

Rsync-avl--delete--exclude [email protected]:: mokuaiming /test./--password-file=/home/admin/rsyncd.passwd (rsync reference term, more complete)


Rsync Backend Service mode

Configuration file:

/etc/rsyncd.conf (config file, customizable, now auto-loaded)


Configuration file Contents:

prot=8730

Log File=/var/log/rsync.log

PID File=/var/run/rsync.pid


[Mokuaiming]

Path=/tmp/rsync #目录要真实存在

Use Chroot=yes #是否把登录用户限定在当前目录下, there are restrictions on soft links, if you have a soft link file, you need to change to No

Max Connections=4

Read Only=no #登录到该目录下, and the qualified directory file is read-only, if you need to download the server file, you need to change to No

List=yes #能否使用rsync--prot 8730 192.168.31.182 command to list the module names

Uid=root

Gid=root

Auth Users=sponge

Secret FILE=/ETC/RS.PASSWD #密码权限需要可读

Hosts allow=192.168.31.182 192.168.31.18 #允许哪些ip能够连接

[Mokuaiming2] #不需要用户认证都可以拷贝, and any machine can be connected

path=/tmp/rsync123 #目录要真实存在

Use Chroot=yes #是否把登录用户限定在目录下

Max Connections=4

Read Only=no #登录到该目录下, and read-only

List=yes #是否把模块名字列出

Uid=root

Gid=root


Rsync--demon (initiates the demon process of rsync, does not need to restart the process after changing the configuration file, directly takes effect)

Rsync-avpz--prot 8730 192.168.31.182::mokuaiming/tmp/rsync/1.txt./(Synchronous file format)

Rsync-avpz--prot 8730 [email protected]::mokuaiming2/tmp/rsync123/1.txt./(Synchronous file format)

Rsync-avpz--prot 8730--password-file=/tmp/rsync.passwd.txt [email protected]::mokuaiming2/tmp/rsync123/1.txt./(Not required To enter a password, can be transferred directly, but the password file needs to write a password, and a file can only save one password)


diff (compare two files with differences)

How to use:

DIFF/TMP/1.TXT/ETC/INIT.D (comparison of two files and similarities)


Rsync installation and configuration under Linux

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.