nfs客户端总是无法获取最新数据

在centOS6.8上, 我将一个远程机器的nfs,mount到本地:

mount -o rw -t nfs4 192.168.10.29:/var/fes/ /mnt/fes

当在nfs服务器上修改了文件后,发现本地程序读取到的文件内容依旧是旧的内容。【我发现,ls一下那个挂载的目录,之后就能看到最新的内容了,不知道时什么原因】

 

搜到2篇文章:

https://stackoverflow.com/questions/13681559/nfs-client-side-locking-for-a-file-currently-being-written-to-in-the-remote-nfs

https://www.cnblogs.com/yum777/p/6228723.html

需要给mount命令添加noac的选项,但是添加这个选项后,问题并没有解决。

 

继续搜索:

有人报出一个bug,说使用noac无效,但是使用actimeo=0可以解决这个问题。 验证过,这个选项确实可以解决问题。为了避免频繁的网络请求,我使用actimeo=1

 

说是这些选项的用途吧:

ac: attribute cache   目的是缓存文件属性信息,防止过于频繁的对nfs服务器的网络请求。(cache时间的长短可以配置,使用man nfs查看)

noac: 也就是不缓存了

 

ac的时间长短可以通过下面四个选项配置:

        acregmin=n     The minimum time (in seconds) that the NFS client caches attributes of a regular file before it requests fresh attribute information from a server.  If this option is not specified, the NFS client uses a 3-second minimum.

       acregmax=n     The maximum time (in seconds) that the NFS client caches attributes of a regular file before it requests fresh attribute information from a server.  If this option is not specified, the NFS client uses a  60-second  maxi-
                      mum.

       acdirmin=n     The minimum time (in seconds) that the NFS client caches attributes of a directory before it requests fresh attribute information from a server.  If this option is not specified, the NFS client uses a 30-second minimum.

       acdirmax=n     The maximum time (in seconds) that the NFS client caches attributes of a directory before it requests fresh attribute information from a server.  If this option is not specified, the NFS client uses a 60-second maximum.

       actimeo=n      Using actimeo sets all of acregmin, acregmax, acdirmin, and acdirmax to the same value.  If this option is not specified, the NFS client uses the defaults for each of these options listed above.
 

 

 

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值