Windows服务器向Linux服务器传输文件的方法

发布于 2024-10-05 00:24:51 字数 642 浏览 0 评论 0原文

我需要定期将包含类似 Web 服务器日志的文件从美国的 Windows 生产服务器传输到印度的 Linux 服务器。每个文件的大小约为 4 MB,每分钟大约获得 1 个文件。在 Windows 中写入文件和在 Linux 机器中使用它们之间可能需要大约 5 分钟的延迟。我对这里的各种选项有点困惑,因为我在这种设计方面相当缺乏经验:

  1. 我正在考虑在 C#.NET 中编写一个服务,该服务将定期存档、压缩并将它们发送到 Linux 机器。这些文件非常可压缩。 WinRAR 可以将 32 MB 的这些文件转换为 1.2 MB 的存档。这样应该可以解决网络传输速度问题。那么到底如何将文件传输到linux呢?我可以使用 samba 在 Windows 服务器上安装 Linux 驱动器,或者我应该创建一个 ftp 服务器,或者发送序列化为 POST 请求的文件。哪一个会好呢?另外,我必须尽量减少 Windows 服务器上的负载。

  2. 将 Windows 驱动器安装到 Linux 上。我可以使用 mount 命令,也可以在这里使用 samba(这两者有何优缺点?)。然后我可以在Linux本身中编写压缩和复制部分。

我不相信互联网连接非常稳定,因此也应该有良好的重试机制和故障保护。在这些情况下有哪些潜在的问题,以及我必须担心的其他问题?

谢谢, 哈里

I need to transfer webserver-log-like-files containing periodically from windows production servers in the US to linux servers here in India. The files are ~4 MB in size each and I get about 1 file per minute. I can take about 5 mins lag between the files getting written in windows and them being available in the linux machines. I am a bit confused between the various options here as I am quite inexperienced in such design:

  1. I am thinking of writing a service in C#.NET which will periodically archive, compress and send them over to the linux machines. These files are pretty compressible. WinRAR can convert 32 MB of these files into a 1.2 MB archive. So that should solve the network transfer speed issue. But then how exactly do I transfer files to linux? I could mount linux drive on windows server using samba, or should I create an ftp server, or send the file serialized as a POST request. Which one would be good? Also, I have to minimize the load on the windows server.

  2. Mount the windows drive on linux instead. I could use the mount command or I could use samba here (What are the pros and cons of these two?). I can then write the compressing and copying part in linux itself.

I don't trust the internet connection to be very stable, so there should be a good retry mechanism and failure protection too. What are the potential gotchas in these situations, and other points that I must be worried about?

Thanks,
Hari

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

梅倚清风 2024-10-12 00:24:51

RAR 很糟糕。坚持使用 7zip 或 bzip2。使用 ssh 传输它,可能使用 rsync,因为它可以容忍链接故障。

RAR is bad. Stick to 7zip or bzip2. Transfer it using ssh, probably with rsync since it can be link-failure-tolerant.

顾挽 2024-10-12 00:24:51

WinSCP可以帮助您通过脚本批量将文件从Windows传输到Linux。然后配置 Windows 任务计划程序以定期运行该脚本。

我从这篇文章中一步步学习: https://techglimpse.com/批处理脚本自动文件传输winscp/

WinSCP can help you transfer files from Windows to Linux in batch with script. Then configure Windows Task Scheduler to run the script periodically.

I learnt from this post step by step: https://techglimpse.com/batch-script-automate-file-transfer-winscp/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文