1、排除复制:
(1)
~]# rsync -avz /data/ --exclude=a --exclude=b rsync_backup@172.16.1.41::backup
sending incremental file list
./
c
d
sent 148 bytes received 65 bytes 426.00 bytes/sec
total size is 0 speedup is 0.00
(2)
连续的文件传输
~]# rsync -avz /data/ --exclude={1..4} rsync_backup@172.16.1.41::backup
(3)--exclude-from 从文件中排除
~]# ls /data/
10 12 14 16 18 20
11 13 15 17 19 paichu.txt
~]# cat /data/paichu.txt
10
11
12
13
14
15
~]# rsync -avz /data/ --exclude-from=/data/paichu.txt rsync_backup@172.16.1.41::backup
sending incremental file list
./
16
17
18
19
20
paichu.txt
2、删除
rsync作为镜像,相当于raid1,让两台服务器同步
--delete
实践:
(1)推送:
~]# rsync -avz --delete /data/ rsync_backup@172.16.1.41::backup
##本地目录有啥,远端就有啥
注意:远端目录是不是东西更多,多了东西会被删除
(2)拉取:
~]# rsync -avz --delete rsync_backup@172.16.1.41::backup /data/
##注意:远端有啥本地目录就有啥,注意本地/data目录