rsync:include和exclude参数
2010-11-18 11:06
218 查看
注意:include和exclude使用的目录,均为path定义的相对路径
环境:两台虚拟机128和130,在128上配置RsyncServer;130上做同步测试
rsync服务配置文件
vim /etc/rsyncd.conf
uid = nobody
gid = nobody
use chroot = no
max connections = 4
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
log file = /var/log/rsyncd.log
[nagios-53]
path = /opt
include = db1/
exclude = db1/1.log
read only = true
hosts allow = 192.168.128.130
hosts deny = 0.0.0.0/0
auth users = backup
secrets file = /etc/rsyncd/.rsync.pas
在128的/opt目录下有db1,db2,db3三个目录,里面分别有1.log、2.log、3.log文件
每次测试只修改配置rsync的配置文件,不需要重启rsync服务。
测试开始:
第一次:同步db1
include = db1/
exclude = db2/ db3/
同步命令
rsync -tvzrp --progress --password-file=/etc/.rsync backup@192.168.128.128::nagios-53 /home
同步结果:
receiving file list ...
3 files to consider
./
db1/
db1/1.log
0 100% 0.00kB/s 0:00:00 (xfer#1, to-check=0/3)
sent 140 bytes received 186 bytes 652.00 bytes/sec
total size is 0 speedup is 0.00
第二次:同步db1和db2
include = db1/ db2/
exclude = db3/
同步命令:
rsync -tvzrp --progress --password-file=/etc/.rsync backup@192.168.128.128::nagios-53 /home
同步结果:
receiving file list ...
5 files to consider
./
db1/
db1/1.log
0 100% 0.00kB/s 0:00:00 (xfer#1, to-check=2/5)
db2/
db2/2.log
0 100% 0.00kB/s 0:00:00 (xfer#2, to-check=0/5)
sent 168 bytes received 262 bytes 860.00 bytes/sec
total size is 0 speedup is 0.00
第三次:只同步db1
include = db1/
exclude = *
同步命令:
rsync -tvzrp --progress --password-file=/etc/.rsync backup@192.168.128.128::nagios-53 /home
同步结果:
receiving file list ...
2 files to consider
./
db1/
sent 118 bytes received 126 bytes 488.00 bytes/sec
total size is 0 speedup is 0.00
第四次:
include = db1/
exclude = db1/1.log
同步命令:
rsync -tvzrp --progress --password-file=/etc/.rsync backup@192.168.128.128::nagios-53 /home
同步结果:
receiving file list ...
6 files to consider
./
db1/
db2/
db2/2.log
0 100% 0.00kB/s 0:00:00 (xfer#1, to-check=2/6)
db3/
db3/3.log
0 100% 0.00kB/s 0:00:00 (xfer#2, to-check=0/6)
sent 174 bytes received 280 bytes 908.00 bytes/sec
total size is 0 speedup is 0.00
第五次:
include = db1/
#exclude = db1/1.log
同步命令:
rsync -tvzrp --progress --password-file=/etc/.rsync backup@192.168.128.128::nagios-53 /home
同步结果:
receiving file list ...
7 files to consider
./
db1/
db1/1.log
0 100% 0.00kB/s 0:00:00 (xfer#1, to-check=4/7)
db2/
db2/2.log
0 100% 0.00kB/s 0:00:00 (xfer#2, to-check=2/7)
db3/
db3/3.log
0 100% 0.00kB/s 0:00:00 (xfer#3, to-check=0/7)
第六次:
#include = db1/
exclude = db1/1.log db2/ db3/
同步命令:
rsync -tvzrp --progress --password-file=/etc/.rsync backup@192.168.128.128::nagios-53 /home
同步结果:
receiving file list ...
2 files to consider
db1/
sent 112 bytes received 120 bytes 464.00 bytes/sec
total size is 0 speedup is 0.00
本文出自 “在技术的光环下熠熠生辉” 博客,请务必保留此出处http://ninglianjie.blog.51cto.com/777346/426360
环境:两台虚拟机128和130,在128上配置RsyncServer;130上做同步测试
rsync服务配置文件
vim /etc/rsyncd.conf
uid = nobody
gid = nobody
use chroot = no
max connections = 4
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
log file = /var/log/rsyncd.log
[nagios-53]
path = /opt
include = db1/
exclude = db1/1.log
read only = true
hosts allow = 192.168.128.130
hosts deny = 0.0.0.0/0
auth users = backup
secrets file = /etc/rsyncd/.rsync.pas
在128的/opt目录下有db1,db2,db3三个目录,里面分别有1.log、2.log、3.log文件
每次测试只修改配置rsync的配置文件,不需要重启rsync服务。
测试开始:
第一次:同步db1
include = db1/
exclude = db2/ db3/
同步命令
rsync -tvzrp --progress --password-file=/etc/.rsync backup@192.168.128.128::nagios-53 /home
同步结果:
receiving file list ...
3 files to consider
./
db1/
db1/1.log
0 100% 0.00kB/s 0:00:00 (xfer#1, to-check=0/3)
sent 140 bytes received 186 bytes 652.00 bytes/sec
total size is 0 speedup is 0.00
第二次:同步db1和db2
include = db1/ db2/
exclude = db3/
同步命令:
rsync -tvzrp --progress --password-file=/etc/.rsync backup@192.168.128.128::nagios-53 /home
同步结果:
receiving file list ...
5 files to consider
./
db1/
db1/1.log
0 100% 0.00kB/s 0:00:00 (xfer#1, to-check=2/5)
db2/
db2/2.log
0 100% 0.00kB/s 0:00:00 (xfer#2, to-check=0/5)
sent 168 bytes received 262 bytes 860.00 bytes/sec
total size is 0 speedup is 0.00
第三次:只同步db1
include = db1/
exclude = *
同步命令:
rsync -tvzrp --progress --password-file=/etc/.rsync backup@192.168.128.128::nagios-53 /home
同步结果:
receiving file list ...
2 files to consider
./
db1/
sent 118 bytes received 126 bytes 488.00 bytes/sec
total size is 0 speedup is 0.00
第四次:
include = db1/
exclude = db1/1.log
同步命令:
rsync -tvzrp --progress --password-file=/etc/.rsync backup@192.168.128.128::nagios-53 /home
同步结果:
receiving file list ...
6 files to consider
./
db1/
db2/
db2/2.log
0 100% 0.00kB/s 0:00:00 (xfer#1, to-check=2/6)
db3/
db3/3.log
0 100% 0.00kB/s 0:00:00 (xfer#2, to-check=0/6)
sent 174 bytes received 280 bytes 908.00 bytes/sec
total size is 0 speedup is 0.00
第五次:
include = db1/
#exclude = db1/1.log
同步命令:
rsync -tvzrp --progress --password-file=/etc/.rsync backup@192.168.128.128::nagios-53 /home
同步结果:
receiving file list ...
7 files to consider
./
db1/
db1/1.log
0 100% 0.00kB/s 0:00:00 (xfer#1, to-check=4/7)
db2/
db2/2.log
0 100% 0.00kB/s 0:00:00 (xfer#2, to-check=2/7)
db3/
db3/3.log
0 100% 0.00kB/s 0:00:00 (xfer#3, to-check=0/7)
第六次:
#include = db1/
exclude = db1/1.log db2/ db3/
同步命令:
rsync -tvzrp --progress --password-file=/etc/.rsync backup@192.168.128.128::nagios-53 /home
同步结果:
receiving file list ...
2 files to consider
db1/
sent 112 bytes received 120 bytes 464.00 bytes/sec
total size is 0 speedup is 0.00
本文出自 “在技术的光环下熠熠生辉” 博客,请务必保留此出处http://ninglianjie.blog.51cto.com/777346/426360
相关文章推荐
- rsync命令中的include参数顺序问题
- rsync --exclude 参数
- C++test 关于resource参数和include/exclude参数说明
- expdp及impdp中的exclude及include参数
- inotify-tools + rsync 实现实时文件同步关于exclude参数处理
- rsync exclude include二级目录或子级目录
- expdp、impdp的exclude、include参数格式说明
- 【SpringMVC】<context:include-filter>和<context:exclude-filter>使用时要注意的地方
- linux命令之tar中的exclude参数
- spring中的context:include-filter和context:exclude-filter的区别
- rsync 配置说明和命令参数
- s:include带url形式的参数需进行URL中文编解码
- rsync命令排除文件和文件夹(exclude-from)
- 关于xcopy的exclude参数的使用
- 批量拷贝时跳过某个文件或文件夹 xcopy的EXCLUDE参数用法
- <context:include-filter>和<context:exclude-filter>区别
- rsync工作方式及命令参数
- rsync的参数files-from用法及注意事项
- Include and Exclude Tags
- context:exclude-filter 与 context:include-filter