NFS 一台有文件、一台没文件

2022-01-28  本文已影响0人  偷油考拉

某系统前置机下载文件到NFS存储,并检测文件存在;后置机随后跑批提示没有发现改文件。

https://blog.csdn.net/kosmosas/article/details/70241451
http://blog.chinaunix.net/uid-10565106-id-3402319.html

参考资料: 源自 nfs man

The sync mount option

NFS client 对待 sync 挂载参数与其他系统有些区别(参见 mount(8) 查看关于通用sync和async挂载参数的描述)。 如果都不指定(或者只指定 async 参数),NFS client 会推迟发送应用的写入到服务器,直到如下事件发生:

换句话说,正常情况下,应用写入的数据不会立即显示在保存文件的服务器上。

如果在挂载点上配置了 sync 参数,任何写入数据到挂载点文件的系统调用都会导致,系统调用在返回控制权给用户空间之前,数据刷新到服务器。这给 clients 提供了很好的数据缓存一致性,但是性能代价很高。

应用可以使用 O_SYNC open flag 来强制应用对单个文件的写入立即转到服务器而无需使用sync挂载配置项。


 ac / noac        配置客户端是否缓存文件属性。如果都没有配置(或者配置 ac),client 将缓存文件属性。

                  为了提升性能,NFS clients 会缓存文件属性。每隔几秒钟,NFS  client 会检查服务器上的文件属性版本以获取更新。
                  直到client再次检查服务器前,在这些小间隔内发生在服务器上的变动仍然没有被检测到。
                  noac 配置项阻止了 clients 缓存文件属性,这样应用可以快速的检查服务器上文件的变动。

                  除了阻止 client 缓存文件属性,noac 配置项还强制应用同步写入,这样本地文件变更可以立即在服务器上可见。
                  这样,其他 clients 检查文件属性的时候就可以快速的发现最近的写入操作了。

                  使用 noac 配置项可以在访问同一文件的 NFS clients 之间提供更高的缓存一致性,但会导致显著的性能损失。
                  因此,鼓励适当的使用文件锁。
                  数据和元数据一致性部分详细讨论了这些权衡。

rsize=n        The maximum number of bytes in each network READ request that the NFS client can receive when reading data
                  from  a  file  on  an  NFS  server.   The actual data payload size of each NFS READ request is equal to or
                  smaller than the rsize setting. The largest read payload supported by the Linux NFS  client  is  1,048,576
                  bytes (one megabyte).

                  The  rsize  value  is  a  positive  integral multiple of 1024.  Specified rsize values lower than 1024 are
                  replaced with 4096; values larger than 1048576 are replaced with 1048576. If a specified value  is  within
                  the supported range but not a multiple of 1024, it is rounded down to the nearest multiple of 1024.

                  If an rsize value is not specified, or if the specified rsize value is larger than the maximum that either
                  client or server can support, the client and server negotiate the largest rsize value that they  can  both
                  support.

                  The  rsize  mount option as specified on the mount(8) command line appears in the /etc/mtab file. However,
                  the effective rsize value negotiated by the client and server is reported in the /proc/mounts file.

   wsize=n        The maximum number of bytes per network WRITE request that the NFS client can send when writing data to  a
                  file  on an NFS server. The actual data payload size of each NFS WRITE request is equal to or smaller than
                  the wsize setting. The largest write payload supported by the Linux NFS client  is  1,048,576  bytes  (one
                  megabyte).

                  Similar  to rsize , the wsize value is a positive integral multiple of 1024.  Specified wsize values lower
                  than 1024 are replaced with 4096; values larger than 1048576 are replaced with  1048576.  If  a  specified
                  value is within the supported range but not a multiple of 1024, it is rounded down to the nearest multiple
                  of 1024.

                  If a wsize value is not specified, or if the specified wsize value is larger than the maximum that  either
                  client  or  server can support, the client and server negotiate the largest wsize value that they can both
                  support.

                  The wsize mount option as specified on the mount(8) command line appears in the /etc/mtab  file.  However,
                  the effective wsize value negotiated by the client and server is reported in the /proc/mounts file.
上一篇 下一篇

猜你喜欢

热点阅读