这是我的设置:一台 NFS 服务器机器,两台 NFS 客户端机器。
客户端机器将文件写入 NFS 挂载,但有时,这些文件不会出现在 NFS 服务器机器或其他客户端机器上.....
我对这个问题完全困惑不已...如能得到任何帮助我将非常感激!
答案1
不立即出现或一段时间不出现?
NFS 默认会在系统内核级别对目录和文件内容进行一定程度的缓存。如果计算机一更新了某个文件,而计算机二的缓存中仍有该文件的副本,那么如果计算机二尝试访问该文件,则可能在缓存过期之前无法看到该文件的较新版本。
检查 nfs 的手册页以了解以下参数:
acregmin=n The minimum time in seconds that attributes of a regu-
lar file should be cached before requesting fresh
information from a server. The default is 3 seconds.
acregmax=n The maximum time in seconds that attributes of a regu-
lar file can be cached before requesting fresh informa-
tion from a server. The default is 60 seconds.
acdirmin=n The minimum time in seconds that attributes of a direc-
tory should be cached before requesting fresh informa-
tion from a server. The default is 30 seconds.
acdirmax=n The maximum time in seconds that attributes of a direc-
tory can be cached before requesting fresh information
from a server. The default is 60 seconds.
actimeo=n Using actimeo sets all of acregmin, acregmax, acdirmin,
and acdirmax to the same value. There is no default
value.
noac Disable all forms of attribute caching entirely. This
extracts a significant performance penalty but it
allows two different NFS clients to get reasonable
results when both clients are actively writing to a
common export on the server.