rsync是类unix系统下的数据镜像备份工具,从软件的命名上就可以看出来了——remote sync。它的特性如下:

1、可以镜像保存整个目录树和文件系统。
2、可以很容易做到保持原来文件的权限、时间、软硬链接等等。
3、无须特殊权限即可安装。
4、优化的流程,文件传输效率高。
5、可以使用rcp、ssh等方式来传输文件,当然也可以通过直接的socket连接。
6、支持匿名传输。

安装rsync
#tar zxvf rsync-3.0.8.tar.gz
#cd rsync-3.0.8
#./configure && make && make install

cat /etc/rsync.conf
uid = root
gid = root
use chroot = no
max connections = 20
strict modes = yes
log file = /var/log/rsyncd.log
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
log format = %t %a %m %f %b
[web]
path = /data/server/test  #备份目录
use chroot = yes
read only = no


备份机上运行
[root@lx_web_s1 ~]#cd test
[root@lx_web_s1 test]# rsync -aP 192.168.52.175::web .
receiving file list ...
2 files to consider
./
121/
成功

如果要想与源目录数据保存一致:rsync -aP --delete 192.168.52.175::web .