rsync同步时提示

@ERROR: Unknown module 'www[防采集6ns.net]back'
rsync error: error starting client-server protocol (code 5) at main.c(1516) [Receiver=3.0.9]

服务器架构如下

rsyncd.conf配置如下

pid file = /home/rsync/rsync.pid
lock file = /home/rsync/rsync.lock
log file = /home/rsync/rsync.log
port = 5001
uid = root
gid = root
comment = www backup
max connections = 50
timeout = 300

[wwwback]
path = /home/nfs/www
read only = yes
list = no
auth users = abcdefg
use chroot = yes
hosts allow = 11.22.33.44
secrets file = /home/rsync/nginx.password

当nginx服务器发起同步请求时,经过转发服务器链接到企业内部rsync服务器,此过程没有任何问题.且rsync已启动.

下面是rsync服务器的日志

2018/05/05 23:37:48 [2285] name lookup failed for 10.0.0.79: Name or service not known
2018/05/05 23:37:48 [2285] connect from UNKNOWN (10.0.0.79)
2018/05/05 23:37:49 [2285] rsync: connection unexpectedly closed (40 bytes received so far) [Receiver]
2018/05/05 23:37:49 [228[防采集]5] rsync error: error in rsync protocol data stream (code 12) at io.c(605) [Receiver=3.0.9]
2018/05/05 23:42:52 [2607] rsyncd version 3.0.9 starting, listening on port 5001

添加主机名到hosts

[root@localhost rsync]# uname -n
localhost.localdomain
[root@localhost rsync]# echo "10.0.0.79 localhost localhost.localdomain" >> /etc/hosts

重启rsync后,又出现错误

2018/05/05 23:44:25 [2700] connect from localhost (10.0.0.79)
2018/05/05 23:44:25 [2700] rsync: connection unexpectedly closed (40 bytes received so far) [Receiver]
2018/05/05 23:44:25 [2700] rsync error: error in rsync protocol data stream (code 12) at io.c(605) [Receiver=3.0.9]

这就明显了,rsyncd.conf里的hosts allow不能填写外部nginx服务器的IP地址,因为它是通过转发服务器中转的,所以需要填写转发客户端的IP地址.

2018/05/06 03:47:02 [2849] rsync on wwwback/ from 3c819ffb712cbc32@localhost (10.0.0.79)
2018/05/06 03:47:02 [2849] building file list
2018/05/06 03:47:03 [2849] sent 101482 bytes  received 559 bytes  total size 171497754

到此,rsync问题解决了.

作者: Spectre
来源: https://6ns.net/post-1247.html

许可协议: 本作品采用知识共享署名-非商业性使用-禁止演绎 3.0 进行许可。

您可以: 以任意方式自由的复制,发行本作品
署名: 您必须给出适当的署名并声明许可协议,同时标明是否(对原始作品)作了修改。您可以用任何合理的方式来署名,但是不得以任何方式暗示许可人为您或您的使用背书。
非商业性使用: 您不得将本作品用于商业目的.
禁止演绎: 如果您再混合,转换,或者基于该作品的创作,您不可以分发修改作品.

请复制到这里 <--------

标签:
Spectre

About the author: 被一个人指责,说明你做的不够好。被一堆人指责,说明你已经成功了。

发表评论

电子邮件地址不会被公开。

2 × 4 =