NFS客户端阻塞睡眠问题与配置调研
Linux NFS客户端需要很小心地配置,否则在NFS服务器崩溃时,访问NFS的程序会被挂起,用ps查看,进程状态(STAT)处于D,意为(由于IO阻塞而进入)不可中断睡眠(如果是D+,+号表示程序运行于前台进程组)[1]。
为此,最新的Hadoop HA方案Quorum-Journal的作者在设计文档中对NFS共享存储保存NameNode元数据的作法如下诟病[2]:
- 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.
- 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.
- 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客户端阻塞睡眠问题与配置调研的更多相关文章
- NFS相关、NFS服务端安装配置、exportfs命令、nfs客户端的问题
1.NFS (network file system,基于RPC协议) 2.NFS服务端安装配置安装服务端:yum install nfs-utils rpcbind -y安装客户端:yum inst ...
- nfs的无敌时间更改的配置参数
nfs服务端重启之后,共享文件夹进入grace time(无敌时间) 客户端在服务端重启后写入数据大概要等90秒 nfs配置文件:/etc/sysconfig/nfs [root@backup ~]# ...
- NFS笔记(一)NFS服务器工作原理及详细配置
一.NFS工作原理 1.什么是NFS服务器 NFS就是Network File System的缩写,它最大的功能就是可以通过网络,让不同的机器.不同的操作系统可以共享彼此的文件. NFS服务器可以让P ...
- nfs下的exportfs命令和nfs客户端重新挂载
工作中,如果使用了nfs服务器,会遇到修改nfs服务器配置的情况,如果想重新让客户端加载上修改后的配置,但是又不能重启rpcbind服务,我们需要使用export命令了 exportfs命令 常用选项 ...
- NFS客户端挂载目录后无写入权限的解决方案
转载至:https://blog.csdn.net/younger_china/article/details/52089337 在客户机通过 mount -o rw -t nfs 192.168.1 ...
- NFS客户端访问行为相关的几个参数解释
soft / hard Determines the recovery behavior of the NFS client after an NFS request times out. If ne ...
- nfs nobody,nobody 需要在nfs客户端修改从nfs服务器端共享过来的目录怎么办?
1,加入我们使用nfs共享安装oracle, 安装oracle需要修改base,data,orainventory等等目录及自目录的属主及权限,一般会继承nfs客户端目录的权限及属主 groupadd ...
- Linux之nginx反向代理+三台web+nfs共享存储实现集群配置
作业四:nginx反向代理+三台web+nfs共享存储实现集群配置 在各个web服务器上挂载nfs [root@localhost nginx]# mount -t nfs 192.168.152.1 ...
- Oracle 11g即时客户端在windows下的配置
Oracle 11g即时客户端在windows下的配置 by:授客QQ:1033553122 instantclient-basic-nt-11.2.0.3.0.zip客户端压缩包为例 步骤 1. 假 ...
随机推荐
- 001-快速搭建Spring web应用【springboot 2.0.4】-gradle、springboot的启动过程分析、gradle多模块构建
一.概述 学习<精通Spring MVC4>书籍笔记 二.笔记 1.快速构建Spring starter web项目几种方式 1>使用Spring Tool Suite生成Start ...
- 【剑指offer】字符串的排列
一.题目: 输入一个字符串,按字典序打印出该字符串中字符的所有排列.例如输入字符串abc,则打印出由字符a,b,c所能排列出来的所有字符串abc,acb,bac,bca,cab和cba. 二.思路: ...
- RN-TextInput组件去掉下划线
<View style={styles.container}> <TextInput style={styles.textInputStyle} underlineColorAndr ...
- HTML中--定义header和footer高度中间自适应
<html> <head> <meta charset="utf-8" /> <title></title> <s ...
- 虚拟货币ICO是什么意思 看完秒懂
有这样一个市场,与90年代的互联网泡沫及其相似,它被许多金融界大咖怒指为丧失道德底线的圈钱工具,更被投资者而疯狂追捧.是的,没错,它就是近二年火遍全球的虚拟货币ICO.那么,对于很多投资小白来说,虚拟 ...
- keras后端设置【转载】
转自:https://keras.io/backend/ At this time, Keras has three backend implementations available: the Te ...
- [LeetCode] 884. Uncommon Words from Two Sentences_Easy tag: Hash Table
We are given two sentences A and B. (A sentence is a string of space separated words. Each word co ...
- iOS库
https://medium.com/app-coder-io/33-ios-open-source-libraries-that-will-dominate-2017-4762cf3ce449#.i ...
- ida脚本函数
#打印光标所在位置函数中地址和汇编代码 startaddr=GetFunctionAttr(ea, FUNCATTR_START) items = idautils.FuncItems(startad ...
- 回车和刷新以及Ctr+F5的区别
回车(url跳转)主要是判断本地缓存文件的Expires的有效时间,如果有效则直接使用客户端缓存 不在提交到HTTP服务器 F5 Expires设置不再起效果,只有Last-Modified/ETag ...