目的:客户机B(/data/tongbuB) 《=====》 服务器主机A(/data/tongbuA)

 

1、配置服务器主机A [192.168.0.10]

[1]、安装xinetd (用于管理rsync服务)

[root@www ~]# yum -y install xinetd 
[root@www ~]# vi /etc/xinetd.d/rsync
# default: off
# description: The rsync server is a good addition to an ftp server, as it /
# allows crc checksumming etc.
service rsync

disable = no// change

socket_type = stream

wait = no

user = root

server = /usr/bin/rsync

server_args = --daemon

log_on_failure += USERID

}

[2] 配置主机A. 这个例子是将配置文件

[root@www ~]# vi /etc/rsyncd.conf
[site] // name
path = /var/www/html // copied directory
hosts allow = 192.168.0.20
hosts deny = *
list = true
uid = root
gid = root
[3] 配置主机B 
[root@lan ~]# rsync -avz --delete --exclude-from=/etc/rsync_exclude.lst 192.168.0.18::site /home/backup

// add in cron if you'd like to run rsync.
[root@lan ~]# crontab -e


00 02 * * * rsync -avz --delete --exclude-from=/etc/rsync_exclude.lst 192.168.0.18::site /home/backup