rsync服务一多模块备份

1.修改配置文件,增加两个模块

[root@rsync-A ~]# cat /etc/rsyncd.conf    
uid = rsync
gid = rsync
use chroot = no
max connections = 200
timeout = 300
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
log file = /var/log/rsyncd.log
ignore errors
read only = false
list = false
hosts allow = 10.0.0.0/24
#hosts deny = 0.0.0.0/32
auth users = rsync_liang
secrets file = /etc/rsync.password
[liang]
path = /liang1/
[liang2]
path = /liang2/
[liang3]
path = /liang3/

2.创建目录,授权

[root@rsync-A ~]# mkdir /liang2 /liang3
[root@rsync-A ~]# chown rsync.rsync /liang2
[root@rsync-A ~]# chown rsync.rsync /liang3

3.重启rsync服务

[root@rsync-A ~]# /etc/init.d/rsyncd restart
rsync restart ...                                          [  OK  ]

4.测试
4.1查看客户端/data1目录

[root@rsync-B ~]# ll /data1
total 0
-rw-r--r-- 1  500  500 0 Jul 22 22:47 a
-rw-r--r-- 1 root root 0 Jul 23 03:43 a.txt
-rw-r--r-- 1  500  500 0 Jul 22 22:47 b
-rw-r--r-- 1 root root 0 Jul 23 03:43 b.txt
-rw-r--r-- 1  500  500 0 Jul 22 22:47 c
-rw-r--r-- 1 root root 0 Jul 23 03:43 c.txt
-rw-r--r-- 1  500  500 0 Jul 22 22:47 d
-rw-r--r-- 1 root root 0 Jul 23 03:43 d.txt

4.2将/data1推送到服务端模块liang2

[root@rsync-B ~]# rsync -avz /data1/ rsync_liang@10.0.0.129::liang2 --password-file=/etc/rsync.password  
sending incremental file list
./
a
a.txt
b
b.txt
c
c.txt
d
d.txt

sent 393 bytes  received 163 bytes  1112.00 bytes/sec
total size is 0  speedup is 0.00
服务端查看模块liang2的目录
[root@rsync-A ~]# ll /liang2
total 0
-rw-r--r-- 1 rsync rsync 0 Jul 22 22:47 a
-rw-r--r-- 1 rsync rsync 0 Jul 23 03:43 a.txt
-rw-r--r-- 1 rsync rsync 0 Jul 22 22:47 b
-rw-r--r-- 1 rsync rsync 0 Jul 23 03:43 b.txt
-rw-r--r-- 1 rsync rsync 0 Jul 22 22:47 c
-rw-r--r-- 1 rsync rsync 0 Jul 23 03:43 c.txt
-rw-r--r-- 1 rsync rsync 0 Jul 22 22:47 d
-rw-r--r-- 1 rsync rsync 0 Jul 23 03:43 d.txt

4.3将/data1推送到服务端模块liang3

[root@rsync-B ~]# rsync -avz /data1/ rsync_liang@10.0.0.129::liang3 --password-file=/etc/rsync.password  
sending incremental file list
./
a
a.txt
b
b.txt
c
c.txt
d
d.txt

sent 393 bytes  received 163 bytes  1112.00 bytes/sec
total size is 0  speedup is 0.00
到服务端查看模块liang3的目录
[root@rsync-A ~]# ll /liang3
total 0
-rw-r--r-- 1 rsync rsync 0 Jul 22 22:47 a
-rw-r--r-- 1 rsync rsync 0 Jul 23 03:43 a.txt
-rw-r--r-- 1 rsync rsync 0 Jul 22 22:47 b
-rw-r--r-- 1 rsync rsync 0 Jul 23 03:43 b.txt
-rw-r--r-- 1 rsync rsync 0 Jul 22 22:47 c
-rw-r--r-- 1 rsync rsync 0 Jul 23 03:43 c.txt
-rw-r--r-- 1 rsync rsync 0 Jul 22 22:47 d
-rw-r--r-- 1 rsync rsync 0 Jul 23 03:43 d.txt
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值