rsync – 无法解释的错误

我正在使用这样的脚本:

rsync -avu --delete --progress user@host:~/backup . 

每一次,过了一段时间,收到这个错误:

 rsync: connection unexpectedly closed (10251754 bytes received so far) [receiver] rsync error: error in rsync protocol data stream (code 12) at io.c(226) [receiver=3.1.0] rsync: connection unexpectedly closed (45482 bytes received so far) [generator] rsync error: unexplained error (code 255) at io.c(226) [generator=3.1.0] # generator = Debian 5, rsync version 3.0.3 protocol version 30 (Generator[A]) # receiver = Ubuntu 14.04, rsync version 3.1.0 protocol version 31 (Receiver[A]) 

我有超过十年的rsync经验,我尝试了一切,但我无法弄清楚为什么会发生。

在双方: 我没有错误日志 ,tcpdump没有奇怪的事情,没有连接问题,没有防火墙。 转移只是在某个时候突然停止。

问题不限于一台服务器

我认为这可能是一个rsync版本之间的不兼容的一些国王,所以我切换一个新的服务器(Debian 8)在一个完全不同的服务器场的发电机,我有接收器更新rsync,但我得到这个错误:

 rsync: connection unexpectedly closed (31931964 bytes received so far) [receiver] rsync: [generator] write error: Broken pipe (32) rsync error: unexplained error (code 255) at io.c(820) [generator=3.1.2] rsync error: error in rsync protocol data stream (code 12) at io.c(226) [receiver=3.1.2] # generator = Debian 8, rsync version 3.1.1 protocol version 31 (Generator[B]) # receiver = Ubuntu 14.04, rsync version 3.1.2 protocol version 31 (Receiver[B]) 

然后,我尝试通过代理同步Receiver [A]和Generator [B],它可以工作

 Receiver[A](Italy) <=> HTTP Proxy(Paris) <=> Generator[B](Strasbourg) 

所以现在我有

 Receiver[A] <=> Generator[A] // ERROR Receiver[A] <=> Generator[B] // ERROR Receiver[B] <=> Generator[B] // ERROR Receiver[A] <=> HTTP Proxy <=> Generator[A] // OK Receiver[A] <=> HTTP Proxy <=> Generator[B] // OK 

我也尝试没有HTTP代理

 Receiver[A] <=> Generator[C] // OK Receiver[A] <=> Generator[D] // OK Receiver[A] <=> Generator[E] // ERROR 

其中发生器[C][D][E]是在巴黎服务器(我的HTTP Proxy服务器的同一个服务器场)与rsync 3.0.9, prot. v. 30 rsync 3.0.9, prot. v. 30

所以这里的底线是 :我有多个位置的多个服务器。 在Receiver[A]我没有防火墙,并且事情从几天前运作良好。 现在rsync返回unexplained error ,我不明白为什么。

我认为这是一个phisicalnetworking错误(不在我的机器上)的一些国王,但我不知道我是否能find,隔离和重现此错误。

谢谢你的帮助!

看来你很难指出这个问题,但没有任何问题复制。 在这种情况下,如果您排除了SSH连接本身的故障,以及您获得的数据,这可能会有所帮助。

你可以像下面那样运行你的rsync命令,它会产生一些数据du:

 rsync -e 'bash -x -c "ssh -vvvv $0 $@ 2>/tmp/rsync-ssh.stderr | tee /tmp/rsync.stdout"' -avu --delete --progress user@host:~/backup . 

看这些文件的结尾可能有用。 例如,如果SSH连接中断,则应该在/tmp/rsync-ssh.stderr显示。 如果实际上是另一方面的问题,那么/tmp/rsync.stdout实际的rsync协议转储可能会有一些string提示( strings /tmp/rsync.stdout )。

如果我不得不猜测,这是一个令人讨厌的防火墙或物理问题导致SSH连接丢失的数据包。