就是两台服务器同步数据,一上午都没事,就这个目录同步不了,
首先发,服务肯定是没问题了,那么就是权限问题。然后将源文件及所属目录的属主、属组、权限改为777和同步的用户,仍旧报错,内容如下:
rsync -avP Shost::user/opt/hahaha/ .
receiving incremental file list
rsync: change_dir "/~" (in user) failed: No such file or directory (2)
sent 8 bytes received 94 bytes 204.00 bytes/sec
total size is 0 speedup is 0.00
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1650) [Receiver=3.1.2]
反向复制报错
rsync -avP /opt/hahaha/ Dhost::user/opt/hahaha/
sending incremental file list
rsync: read error: Connection reset by peer (104)
rsync error: error in rsync protocol data stream (code 12) at io.c(759) [sender=3.0.6]
最终解决办法:
将opt目录授权给同步用户
~ ]# cat /etc/rsyncd.conf
address = 10.10.10.10
use chroot = yes
numeric ids = no
read only = no
pid file = /var/run/rsyncd.pid
log file = /var/log/rsync.log
[data]
uid = user1
gid = user1
path = /data
hosts allow = 10.0.0.0/8 192.168.0.0/16
[data1]
uid = user2
gid = user2
path = /
exclude = *
include = data1/***
hosts allow = 10.0.0.0/8 192.168.0.0/16
#updated by force
[vdc]
read only = yes
uid = root
gid = root
path = /
hosts allow = 10.0.0.0/8 192.168.0.0/16
[opt]
uid = user1
gid = user1
path = /
exclude = *
include = opt/***
hosts allow = 10.0.0.0/8 192.168.0.0/16