我们有两台服务器,每个服务器都有一个通过 NFS 映射的目录。
服务器 A 上的进程(shell 脚本)将文件放入映射驱动器中。
服务器 B 上的 Java 进程定期轮询映射驱动器并在找到文件后立即处理该文件。文件处理后 - 它被重命名(然后由服务器 A 上的 cron 进程删除)
该文件是一个小的 .properties 文件。几个周期后一切都运转良好。之后,服务器 A 和服务器 B 开始以不同的方式查看映射驱动器的内容。我们禁用了 NFS 缓存和属性查找。问题仍然存在。
如果我转到视图已损坏的服务器并执行以下操作:
ls
我将看到停滞的文件。但是,如果我再次执行此操作 - 将打印正确的文件列表。
我们将不胜感激任何有关此问题的帮助。
We've got two servers having a directory mapped via NFS to each of them.
Process on server A (shell script) places file into mapped drive.
Java process on server B regularly polls mapped drive and processes the file as soon as it is found. After file is processed - it is renamed (and deleted by cron'ed process on server A afterwards)
The file is a small .properties file. Everything works well for couple of cycles. After that server A and server B start to see contents of mapped drive differently. We disabled NFS caching and attribute lookup. Problem is still there.
If I go to a server which has broken view and do:
ls
I'll see stalled files. BUT, if I do it again - correct file listing is printed.
We'd appreciate any help on the issue.
发布评论
评论(3)
我的问题是,当使用计时器循环时,下面的命令会停止看到实际的目录内容。它与 NFS 服务器不同步。
我得到的解决方案是请求已知不存在的文件。我认为这会使 NFS 客户端修复或刷新其状态。
如果您知道此解决方法背后的机制 - 请分享!
My problem was that when looping with timer, command below stops seeng actual directory content. It gets out of sync with NFS server.
The solution I've got is to request knowingly unexisting file. I assume that this makes NFS client to fix or refresh its state.
If you know the mechanism behind this workaround - please share!
使用哪个 NFS 服务器?如果该服务器支持文件更改通知,您可以使用它而不是轮询。
Which NFS server is used? If that server supports file change notification, you can use that instead of polling.
您禁用了哪种缓存? NFS 支持目录条目缓存,请参阅 acdirmin 和
acdirmax
“nofollow">nfs Linux 手册页。或者同一手册中的“数据和元数据一致性”一章。Which kind of caching have you disabled? NFS supports directory entry caching see the options
acdirmin
andacdirmax
in the nfs Linux man page. Or the chapter "Data And Metadata Coherence" in the same manual.