简体   繁体   English

我们如何使用Python在网络上传输大量数据?

[英]How can we transfer large amounts of data over a network, using Python?

I am working on a task to back up (copy) about 100 Gb of data (including a thousand files and sub folders in a directory) to another server. 我正在处理一项任务,将大约100 Gb的数据(包括目录中的一千个文件和子文件夹)备份(复制)到另一台服务器。 Normally, for the smaller scale, I can use scp or rsync instead. 通常,对于较小的规模,我可以使用scp或rsync。 However, as the other server is not on the same LAN network, it could easily take hours, even days, to complete the task. 但是,由于其他服务器不在同一LAN网络上,因此完成任务可能需要数小时甚至数天。 I can't just leave my computer there with the terminal running. 我不能把电脑留在那里,终端正在运行。 I don't think that's the best choice, and again, I have another good reason to use Python :) 我认为这不是最好的选择,而且我还有另一个使用Python的理由:)

Is there any library, or best practice for me to start with? 我有没有图书馆或最佳实践? As, it's just for in-house project, we don't need any fancy features, just some fundamental things such as logging, error tolerance, etc. 因为,它只适用于内部项目,我们不需要任何花哨的功能,只需要一些基本的东西,如日志记录,容错等。

I think your best bet is to use scp or rsync from within screen. 我认为你最好的选择是在屏幕内使用scp或rsync。 That way you can detach the screen session and logout and the transfer will keep going. 这样你可以分离屏幕会话和注销,转移将继续。

man screen

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM