Mas*_*rry 20 linux file-management rsync file-transfer
我今天有大约 200,000 个文件要传输到新服务器。我以前没有做过这么大规模的任何事情,想就我应该如何做这件事得到一些建议。我正在两个 Centos 6 发行版之间移动它们,它们位于该国的不同位置。我在原始服务器上没有足够的硬盘空间来将所有目录和文件压缩成一个巨大的 tarball,所以我的问题是我应该如何传输所有这些文件?同步?使用 rsync 的一些特殊方式?任何关于如何做的输入/建议都会很棒。
谢谢
编辑:对于那些想知道的人,我强烈建议screen在运行这样的大rsync命令时使用 a 。特别是当可能发生一些愚蠢的事情并且您失去与正在运行rsync命令的服务器 A 的连接时。然后只需分离屏幕并稍后恢复。
ter*_*don 24
只是为了充实西蒙的答案,rsync是完成这项工作的完美工具:
Rsync is a fast and extraordinarily versatile file copying
tool. It can copy locally, to/from another host over any
remote shell, or to/from a remote rsync daemon. It offers a
large number of options that control every aspect of its
behavior and permit very flexible specification of the set of
files to be copied. It is famous for its delta-transfer algo?
rithm, which reduces the amount of data sent over the network
by sending only the differences between the source files and
the existing files in the destination. Rsync is widely used
for backups and mirroring and as an improved copy command for
everyday use.
Run Code Online (Sandbox Code Playgroud)
假设你有远程机器的 ssh 访问权限,你会想要做这样的事情:
rsync -hrtplu path/to/local/foo user@remote.server.com:/path/to/remote/bar
Run Code Online (Sandbox Code Playgroud)
这会将目录复制path/to/local/foo到/path/to/remote/bar远程服务器上。bar/foo将创建一个名为的新子目录。如果您只想复制目录的内容,而不在目标上创建该名称的目录,请添加尾部斜杠:
rsync -hrtplu path/to/local/foo/ user@remote.server.com:/path/to/remote/bar
Run Code Online (Sandbox Code Playgroud)
这会将 的内容复制foo/到远程目录中bar/。
一些相关的选项:
-h, output numbers in a human-readable format
-r recurse into directories
-t, --times preserve modification times
-p, --perms preserve permissions
-l, --links copy symlinks as symlinks
-u, --update skip files that are newer on the receiver
--delete delete extraneous files from dest dirs
-z, --compress compress file data during the transfer
-C, --cvs-exclude auto-ignore files in the same way CVS does
--progress show progress during transfer
--stats give some file-transfer stats
Run Code Online (Sandbox Code Playgroud)
Hen*_*nes 14
这取决于需要复制的速度和可用带宽。
对于较差的网络连接,请考虑装满磁带的卡车的带宽。(阅读:邮寄一个 2.5 英寸硬盘,或者自己将它驱动到那里。300 千兆位驱动器应该很容易找到)。
如果时间不那么重要或者你有足够的带宽,那么 rsync 很棒。如果出现错误,您可以继续而无需重新复制之前的文件。
[编辑] 我忘了补充一点,如果您的数据在复制过程中被使用,您可以多次运行 rsync。
示例:
1) 使用中的数据。Rsync -> 所有数据都被复制。这可能要花点时间。
2) 再次运行 rsync,只复制更改的文件。这应该很快。
您可以多次执行此操作,直到没有更改为止,或者您可以通过在复制期间将数据设为只读来以智能/安全的方式执行此操作。(例如,如果它在一个使用过的共享集上,该共享集为只读。或者 rsync 数据,然后在晚上第二次运行时将共享设置为只读)。
| 归档时间: |
|
| 查看次数: |
21125 次 |
| 最近记录: |