"Connection reset by peer" means that the remote end of the TCP stream (not the end which logged the error) closed the TCP stream unexpectedly. This can happen if the program on the remote end has crashed or been killed, for example. The error can also be induced by some network devices--like stateful firewalls or NAT devices--interfering with the TCP stream.
In the best case, whatever is causing the error could be specific to the scp
program. Rsync
doesn't use scp
so it might be unaffected. Alternately, the problem could be generic to ssh connections between the two servers, or even to any TCP stream between the two servers. You'd probably be running rsync through ssh, so it might experience the same problem you're having with scp.
One of the main features of rsync
is that, when a destination file already exists but has different contents than the source, rsync doesn't need to retransmit the entire file--it just needs to transmit the additional data to make the destination match the source. When you run rsync and it fails before it finishes, you can restart rsync and it'll pick up where it left off, rather than start over. If you find that rsync is crashing on you like scp has been, then this rsync feature will be extremely valuable.
Rsync will not actually try to reconnect on its own, but you can keep running rsync until it reports success. For example, this bash
shell command would do it:
until rsync ...
do
echo Retrying rsync
done