Linux NFS客户端需要很小心地配置,否则在NFS服务器崩溃时,访问NFS的程序会被挂起,用ps查看,进程状态(STAT)处于D,意为(由于IO阻塞而进入)不可中断睡眠(如果是D+,+号表示程序运行于前台进程组)[1]。

为此,最新的Hadoop HA方案Quorum-Journal的作者在设计文档中对NFS共享存储保存NameNode元数据的作法如下诟病[2]:

  1. Custom hardware - the hardware requirements of a NAS device and remotely controllable PDU can be expensive, and also may be different than the standard deployments used elsewhere within some "filer-free" organizations.
  2. Complicated deployment - even after HDFS is installed, the administrator must take extra steps to congure NFS mounts, custom fencing scripts, etc. This complicates HA deployment and may even cause unavailability if misconfigured.
  3. Poor NFS client implementations - in many versions of Linux, NFS client implementations can be buggy, or easy to misconfigure. For example, it is easy for an administrator to misconfigure mount options in such a way that the NameNodes will freeze unrecoverably in some outage scenarios.

此处第3点就是这次需要调研的内容:NFS客户端正确配置以防程序被长时间阻塞。

1.  Hard mount vs Soft mount[3][4]

挂载NFS目录时可以使用hard或soft参数指定client如何处理server的异常(server崩溃或网络连接异常);它们的区别是:

  • soft:如果一个请求失败,client会将错误返回给发起请求的进程;
  • hard:如果一个请求失败,client会在后台无限重试,直到server从异常恢复;发起请求的进程会被阻塞;默认会采用这个做法;

注:soft挂载可能导致隐性的数据损坏,因而应该在客户端响应性比数据完整性更重要的前提下使用该参数;通过增大retrans参数增加重试次数可以削减soft参数带来的风险;

2.  timeo and  retrans[3]

soft超时失败由timeo和retrans参数决定:

  • timeo=n设定一次尝试超时时间为0.n秒,默认60秒;
  • retrans=n设定失败后重试n次,默认3次,仅soft时有效;

通过测试(在client挂载时指定参数,然后将server进程关闭,使用ls访问nfs目标),发现:

  • 不指定soft或hard,测试后进程阻塞进入D+状态,必须被kill -9杀死;(尝试重启server机器,结果相同)
  • 指定hard,与上面結果相同;
  • 指定soft,不设定timeo和retrans,与上面結果相同,一分钟无响应;
  • 指定soft,设定timeo和retrans比较小的数值,很快返回错误:Input/output error

超时时间测试:

  timeo=1 timeo=2 timeo=3 timeo=4 timeo=5
retrans=1 0.3s 0.85s 1.2s 1.88s 2s
retrans=2 0.3s 0.85s 1.2s 1.88s 2s
retrans=3 0.85s 1.8s 2.8s 3s 3.7s
retrans=4 0.85s 1.8s 2.8s 3s 3.7s
retrans=5 0.85s 1.8s 2.8s 3s 3.7s

参考:

[1]man 1 ps:http://linux.die.net/man/1/ps

[2]Quorum-Journal Design:https://issues.apache.org/jira/secure/attachment/12532989/qjournal-design.pdf

[3]man 5 nfs:http://linux.die.net/man/5/nfs

[4]NFS-HOWTO client:http://tldp.org/HOWTO/NFS-HOWTO/client.html

NFS客户端阻塞睡眠问题与配置调研的更多相关文章

  1. NFS相关、NFS服务端安装配置、exportfs命令、nfs客户端的问题

    1.NFS (network file system,基于RPC协议) 2.NFS服务端安装配置安装服务端:yum install nfs-utils rpcbind -y安装客户端:yum inst ...

  2. nfs的无敌时间更改的配置参数

    nfs服务端重启之后,共享文件夹进入grace time(无敌时间) 客户端在服务端重启后写入数据大概要等90秒 nfs配置文件:/etc/sysconfig/nfs [root@backup ~]# ...

  3. NFS笔记(一)NFS服务器工作原理及详细配置

    一.NFS工作原理 1.什么是NFS服务器 NFS就是Network File System的缩写,它最大的功能就是可以通过网络,让不同的机器.不同的操作系统可以共享彼此的文件. NFS服务器可以让P ...

  4. nfs下的exportfs命令和nfs客户端重新挂载

    工作中,如果使用了nfs服务器,会遇到修改nfs服务器配置的情况,如果想重新让客户端加载上修改后的配置,但是又不能重启rpcbind服务,我们需要使用export命令了 exportfs命令 常用选项 ...

  5. NFS客户端挂载目录后无写入权限的解决方案

    转载至:https://blog.csdn.net/younger_china/article/details/52089337 在客户机通过 mount -o rw -t nfs 192.168.1 ...

  6. NFS客户端访问行为相关的几个参数解释

    soft / hard Determines the recovery behavior of the NFS client after an NFS request times out. If ne ...

  7. nfs nobody,nobody 需要在nfs客户端修改从nfs服务器端共享过来的目录怎么办?

    1,加入我们使用nfs共享安装oracle, 安装oracle需要修改base,data,orainventory等等目录及自目录的属主及权限,一般会继承nfs客户端目录的权限及属主 groupadd ...

  8. Linux之nginx反向代理+三台web+nfs共享存储实现集群配置

    作业四:nginx反向代理+三台web+nfs共享存储实现集群配置 在各个web服务器上挂载nfs [root@localhost nginx]# mount -t nfs 192.168.152.1 ...

  9. Oracle 11g即时客户端在windows下的配置

    Oracle 11g即时客户端在windows下的配置 by:授客QQ:1033553122 instantclient-basic-nt-11.2.0.3.0.zip客户端压缩包为例 步骤 1. 假 ...

随机推荐

  1. 照葫芦画瓢之爬虫豆瓣top100

    import requestsimport reimport jsonfrom requests.exceptions import RequestExceptiondef get(url):    ...

  2. Linux下Nginx安装

    前提: 1.需要gcc环境:yum install gcc-c++ 2.需要第三方开发包: PCRE.zlib.openssl yum install -y pcre pcre-devel yum i ...

  3. Elasticsearch 搜索模块之Cross Cluster Search(跨集群搜索)

    Cross Cluster Search简介 cross-cluster search功能允许任何节点作为跨多个群集的federated client(联合客户端),与tribe node不同的是cr ...

  4. jenkins 的一个BUG

    最近更新了一批jenkin插件,更新完问题来了全局设置无法保存了... 报错如下 Stack trace net.sf.json.JSONException: null object at net.s ...

  5. 【LeetCode每天一题】Next Permutation(下一个排列)

    Implement next permutation, which rearranges numbers into the lexicographically next greater permuta ...

  6. 2019年UI和UX设计趋势:大概是最全的汇总了!

    朋友们,很快,2018就要跟我们说

  7. react全局的公共组件-------弹框 (Alert)

    最近研究react,发现写一个组件很容易,但是要写一个全局的好像有点麻烦.不能像VUE一样,直接在原型上面扩展,注册全局组件 下面实现一个弹框,只需要引入之后,直接调用方法即可,不需要写入组件 给出我 ...

  8. 17.在自适应屏幕里通过JQ来获取宽高并赋给需要的

    在自适应屏幕里通过JQ来获取宽高并赋给需要的div. var height = document.documentElement.clientHeight; $(window).height();(同 ...

  9. vue-lazyload的使用

    1.下载依赖 npm install vue-lazyload --save 2.引入 import Vue from 'vue' import App from '@/App' import Vue ...

  10. GetLastError()返回值列表

    GetLastError()返回值列表: [0]-操作成功完成.[1]-功能错误.[2]-系统找不到指定的文件.[3]-系统找不到指定的路径.[4]-系统无法打开文件.[5]-拒绝访问.[6]-句柄无 ...