Rsync服务客户端排除打包法
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Rsync服务客户端排除打包法相关的知识,希望对你有一定的参考价值。
3、Rsync服务客户端排除打包法客户端排除打包法
在我们生产环境中,可能会遇到这种情况,当一个目录下面有多个文件的时候,由于其中有一个文件比较大,并且我们也不需要被客户端拉取,那么此时我们就可以使用排除打包来实现,过滤一个或者多个文件。 示例: 1、准备同步的文件 [[email protected] ~]# ls /data/ a b c d e f fstab g rc.local 2、测试排除单个文件 [[email protected] ~]# rsync -avz --exclude=a --password-file=/etc/rsync.passwd [email protected]::cce test/ receiving incremental file list ./ b c d e f fstab g rc.local sent 221 bytes received 1107 bytes 2656.00 bytes/sec total size is 1025 speedup is 0.77 3、测试排除多个文件 [[email protected] ~]# rsync -avz --exclude={a,b} --password-file=/etc/rsync.passwd [email protected]::cce test/ receiving incremental file list ./ c d e f fstab g rc.local sent 209 bytes received 1065 bytes 2548.00 bytes/sec total size is 1025 speedup is 0.80 4、批量排除 [[email protected] ~]# rsync -avz --exclude={a..f} --password-file=/etc/rsync.passwd [email protected]::cce test/ receiving incremental file list ./ fstab g rc.local sent 161 bytes received 897 bytes 2116.00 bytes/sec total size is 1025 speedup is 0.97 5、排除一些不规律的文件 [[email protected] ~]# echo -e "a\nd\ne\nf\ng" > /tmp/paichu.txt [[email protected] ~]# cat /tmp/paichu.txt a d e f g [[email protected] ~]# rsync -avz --exclude-from=/tmp/paichu.txt --password-file=/etc/rsync.passwd [email protected]::cce test/ receiving incremental file list ./ b c fstab rc.local sent 173 bytes received 939 bytes 2224.00 bytes/sec total size is 1025 speedup is 0.92
服务端排除打包法
1、让客户端来拉取的时候,过滤一些数据,不允许拉取 [[email protected] ~]# tail -1 /etc/rsyncd.conf exclude=a b #如果是某个目录下那么就可以这样使用 dir/no_sync [root[email protected] ~]# systemctl restart rsyncd [[email protected] ~]# ls /data/ a b c d e f fstab g rc.local 2、测试是否排除成功 [[email protected] ~]# rsync -avz --password-file=/etc/rsync.passwd [email protected]::cce test/ receiving incremental file list ./ c d e f fstab g rc.local sent 195 bytes received 1065 bytes 2520.00 bytes/sec total size is 1025 speedup is 0.81
本文出自 “Char” 博客,请务必保留此出处http://charcce.blog.51cto.com/4255555/1926335
以上是关于Rsync服务客户端排除打包法的主要内容,如果未能解决你的问题,请参考以下文章