I am running some command in cron that does an rsync over two data centers. The connection rate between the data centers is around 1Mbps. I noticed that rsync keeps failing around 2.7GB to 2.9GB of transferred data, which could equal around an hour or more on said connection. I know in the past that our firewall is configured to close idle connections that have opened for more than an hour.
But would an rsync transfer really be idle? What can I do to fix this?
Error:
rsync: connection unexpectedly closed (2987596424 bytes received so far) [receiver]
rsync error: error in rsync protocol data stream (code 12) at io.c(605) [receiver=3.0.9]
rsync: connection unexpectedly closed (523 bytes received so far) [generator]
rsync error: error in rsync protocol data stream (code 12) at io.c(605) [generator=3.0.9]
I already have this in my ~/.ssh/config (but maybe these values need to be increased?):
Host *
ServerAliveInterval 60
ServerAliveCountMax 15
Idle network connection during rsync transfert:
Yes,
rsync
could stay quiet during disk read and while they have no packet to send...You said. our firewall is configured to close idle connections that have opened for more than an hour but nothing about the continuous idle duration.
rsync
process on both ends, reading whole files to search for difference between packets, based on checksums previously computed.While there are no difference between files on both ends, they may be no exchange between both ends until differences are found.
There is a little graphic representing a single rsync run between my desktop and his backup:
In which we may see some seconds elapsed without datas:
Workaround:
As a workaround, you may use socket based ssh sharing:
First run a plain ssh for hanging socket and connection
Than in another window:
In this way, only one connection will be used for both ssh sessions. The
ping
will ensure (a lot of) continuous traffic, thanrsync
could work quietely, using same network connection.