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. SQL Server 安装好后 Always On群组配置

    需要对SQL Server必要的端口打开Windows防火墙的入站规则,比如TCP- 1433端口等. 特别注意:由于AG默认需要用到TCP-5022端口,所以该端口务必保证在Windows防火墙中开 ...

  2. Sql server 2016 Always On 搭建Windows集群配置

    .安装WSFC群集组件 1)打开服务器管理器,选择“功能”,在右边窗口中点击“添加功能”. 2)在添加功能向导中,勾选“故障转移群集”,点击“下一步”. 3)在“确认安装选择”页面中,点击“安装”,进 ...

  3. Python3学习之路~4.3 装饰器

    定义:本质是函数,装饰其他函数就是为其他函数添加附加功能. 原则: 不能修改被装饰函数的源代码 不能修改被装饰函数的调用方式 实现装饰器知识储备: 函数即“变量” 高阶函数 把一个函数名当做实参传递给 ...

  4. 013-并发编程-java.util.concurrent.locks之-AbstractQueuedSynchronizer-用于构建锁和同步容器的框架、独占锁与共享锁的获取与释放

    一.概述 AbstractQueuedSynchronizer (简称AQS),位于java.util.concurrent.locks.AbstractQueuedSynchronizer包下, A ...

  5. 列表 list 容器类型数据(str字符串, list列表, tuple元组, set集合, dict字典)--->元组 tuple-->字符串 str

    # ### 列表 list 容器类型数据(str字符串, list列表, tuple元组, set集合, dict字典) # (1)定义一个列表 listvar = [] print(listvar, ...

  6. Spark Sql数仓报-Metastore contains multiple versions

    Spark版本为2.1.0,Hadoop版本为2.7.1,元数据存储在mysql中,异常信息如下: Exception in thread "main" java.lang.Run ...

  7. Python开发【项目】:选课系统-改良版

    程序名称: 选课系统 角色:学校.学员.课程.讲师要求:1. 创建北京.上海 2 所学校2. 创建linux , python , go 3个课程 , linux\py 在北京开, go 在上海开3. ...

  8. 使用shape设置android控件只有部分边框有颜色

    <?xml version="1.0" encoding="UTF-8"?> <layer-list xmlns:android=" ...

  9. Oracle SQL常用语句

    1,查询插入 insert into user_role(account_id, role_id, create_user) select t.employee_id, 'BC8FBF8B1D9843 ...

  10. 【LeetCode每天一题】Search in Rotated Sorted Array(在旋转数组中搜索)

    Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.(i.e., ...