rsync网络不稳定情况下的大文件传输
由于本人供职的公司提供单机游戏的下载,而单机游戏一般都较大,我们使用了rsync把本地服务器(本地仓库)同步到外国服务器(国外仓库)最后再同步到国外的web前端服务器。
然而总是有某些原因导致外国的有些服务器网络不稳定,再加上同步的文件都较大(30多G的也经常有)。当我们使用rsync -avzP这个命令也会有卡死的时候,那么不妨使用下面的三个参数。
分别为:--inplace , --append ,--append-verify 。具体选哪一个根据实际情况吧。
--inplace
This option changes how rsync transfers a file when its data needs to be updated: instead of the default method of creating a new copy of the file and moving it into place when it is com‐
plete, rsync instead writes the updated data directly to the destination file.
This has several effects:
o Hard links are not broken. This means the new data will be visible through other hard links to the destination file. Moreover, attempts to copy differing source files onto a mul‐
tiply-linked destination file will result in a "tug of war" with the destination data changing back and forth.
o In-use binaries cannot be updated (either the OS will prevent this from happening, or binaries that attempt to swap-in their data will misbehave or crash).
o The file’s data will be in an inconsistent state during the transfer and will be left that way if the transfer is interrupted or if an update fails.
o A file that rsync cannot write to cannot be updated. While a super user can update any file, a normal user needs to be granted write permission for the open of the file for writing
to be successful.
o The efficiency of rsync’s delta-transfer algorithm may be reduced if some data in the destination file is overwritten before it can be copied to a position later in the file. This
does not apply if you use --backup, since rsync is smart enough to use the backup file as the basis file for the transfer.
WARNING: you should not use this option to update files that are being accessed by others,