读取服务器A上的文件写入服务器B
我想从文件生产服务器获取一系列文件,并每晚将提取内容移动到开发服务器。服务器是运行 db2 的 IBM。我可以使用本机驱动程序或 ODBC。
我正在考虑使用 php。一种选择是迭代源文件并插入到开发服务器。另一个想法是将源文件读入数组,然后迭代数组并写入开发服务器。
还有其他方法吗?
I want to pick up series of files from a file production server and move extracts to development server nightly. Servers are IBM running db2. I can use native drivers or ODBC.
I was thinking about using php. One option was to iterate through source file and insert to development server. Another idea was read source file into array and then iterate array and write to development server.
Any other approaches?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果 PHP 脚本要运行一段时间,我建议不要使用它。 PHP 因内存使用而臭名昭著(由于糟糕的垃圾收集)。我提到这一点是因为我最近不得不做一些类似的事情,并放弃了 PHP 来完成这项任务。
抛开意见不谈,最好的解决方案可能是将远程文件系统(通过 NFS、SMB 等)安装在本地系统上(作为文件夹),然后像将文件从一个文件夹复制到另一个文件夹一样。除非您在复制文件时处理文件,否则脚本化解决方案似乎不是最好的方法。
其他不错的选择包括 rsync、scp 以及较小程度上的 FTP。
If the PHP script is going to run for a while, I would recommend not using it. PHP is notorious for memory usage (due to poor garbage collection). I mention this because I recently had to do something similar and bailed on PHP for this task.
Opinion aside, the best solution would probably be to mount the remote file system (via NFS, SMB, etc.) on the local system (as a folder) and just copy the files like you would from one folder to another. Unless you're processing the files as you copy them, a scripted solution doesn't seem like the best approach.
Other great options include rsync, scp, and to a lesser extent FTP.
假设您的 IBM 服务器运行的是 *Nix 风格,则 shell 脚本更可行。
A shell script would be much more feasible to do this assuming your IBM servers are running a *Nix flavor.