Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1862390
  • 博文数量: 117
  • 博客积分: 2559
  • 博客等级: 少校
  • 技术积分: 4385
  • 用 户 组: 普通用户
  • 注册时间: 2010-08-13 20:08
个人简介

作为初学者,要想取得进步,成为高手,首先应该了解自己的不足之处.

文章分类

全部博文(117)

文章存档

2014年(1)

2013年(25)

2012年(13)

2011年(77)

2010年(1)

分类: LINUX

2012-01-09 16:09:45

注意: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

阅读(8236) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~