Rsync incremental synchronization method under Linux

Source: Internet
Author: User
Tags rsync

You can first use Rpm-qa |grep rsync to see if rsync is installed

Let's talk about the Rsyns configuration process.

I. Configuring the server Side

First edit the/etc/rsyncd.conf content as follows:

uid = nobody #进行备份的用户nobody为任何用户gid = nobody #进行备份的组 nobody为任何组use chroot = no #不使用chrootmax connections = 10 #最大连接数log file = /var/log/rsyncd.log #日志文件[rsyncd] # 这里是认证的模块名path = /home/test/ #参与同步的目录ignore errors # 可以忽略一些无关的IO错误read only = yes #只读list = no #不允许列清单anth users = root #认证的用户名secrets file = /etc/rsyncd.secrets #密码文件存放地址

Then edit a rsyncd.secrets password store file under/etc

Format is

User name: password such as root:xl1100

Finally, Rsync is started as a daemon on the server side

The command is:

rsync –daemon

Rsync-initiated port is 873 port

Two. Configuration of the Client

Edit a rsyncd.secrets password store file under/etc

The execution commands are:

rsync -vzurtopg --progress [email protected]::rsyncd /home/test --password-file=/etc/rsync.secret

-

参数 v 表示详细提示z 表示压缩u 表示只进行更新topg 保持文件原有属性如属主、时间的参数--progress 指显示--delete 指如果服务器端删除了这一文件,那么客户端也相应把文件删除,保持真正的一致root 为用户名@192.168.100.150为服务器IP::后面的rsyncd为认证的模块名/home/test 为备份到本地的目录名--password-file=/etc/rsync.secret 制定密码存放位置的地址

You can write scripts rsync.sh

#!/bin/shrsync -vzrtopg --progress [email protected]::rsyncd /home/test --password-file=/etc/rsync.secret

The script is then added to the/etc/crontab file to perform the update periodically

Rsync incremental synchronization method 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.