通过 SSH 进行的 RSync 挂起并因超时而失败

通过 SSH 进行的 RSync 挂起并因超时而失败

客户端:Gentoo、GCC 4.3.4、RSync 3.0.9 服务器:Ubuntu 10.04.4 LTS、RSync 3.0.7

客户端和服务器通过互联网连接,速度约为 2Mbps。Ping 正常。

在任何方向调用任何文件的 RSync 都会挂在随机文件上,然后在超时后失败:

[sender] io timeout after 30 seconds -- exiting
rsync error: timeout in data send/receive (code 30) at io.c(140) [sender=3.0.9]
[sender] _exit_cleanup(code=30, file=io.c, line=140): about to call exit(30)

10 次尝试中有 1 次成功传球。

我尝试添加 SSH 选项 TcpRcvBufPoll=yes、KeepAlive=yes;禁用并启用 rsync 压缩——没有变化。

我怎样才能使 rsync 正常工作?

答案1

首先,我会尝试提高 ssh 传输的详细程度:

rsync -av -e "ssh -vv" /src user@host/dest

其次,它可能挂在远程端的文件或文件系统上。您能否通过 ssh 进入远程端并尝试 tar 相同的目标?

答案2

一种方法是使用 tcpdump

tcpdump port 22 and host <IP>

和 strace

strace -f -o xxx -p <PID of the rsync process>

两端都在运行。发生超时时,您至少应该能够在 tcpdump 的输出中看到不规则的东西。

有了新的信息,您应该能够找到问题的根源。

此外,在两台机器上运行 traceroute 或 mtr 以检查它们之间的路由/连接是否正常。

相关内容