且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

【Linux】 nfs 故障处理

更新时间:2022-08-12 16:11:39

一台备份机down 机了,在服务器启动之后,nfs服务并没有启动,其他使用nfs 挂载此备份机目录的机器使用df -h 会hang住。在启动备份机的nfs 犯了一点小错,没有确认备份机的版本以后还是relh5的,确认了才知道是版本6的
root@rac1 # cat /etc/issue
Red Hat Enterprise Linux Server release 6.0 (Santiago)
查看nfs对应的端口
root@rac1 # netstat -ntlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name   
tcp        0      0 0.0.0.0:111                 0.0.0.0:*                   LISTEN      1361/rpcbind        
tcp        0      0 0.0.0.0:51954               0.0.0.0:*                   LISTEN      1379/rpc.statd      
tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN      1514/sshd           
tcp        0      0 0.0.0.0:20351               0.0.0.0:*                   LISTEN      1578/python         
tcp        0      0 :::111                      :::*                        LISTEN      1361/rpcbind        
tcp        0      0 :::22                       :::*                        LISTEN      1514/sshd           
tcp        0      0 :::42918                    :::*                        LISTEN      1379/rpc.statd      
启动nfs服务的时候报出如下warning
root@rac1 # /etc/init.d/nfs start
WARNING: Deprecated config file /etc/modprobe.conf, all config files belong into /etc/modprobe.d/.
WARNING: Deprecated config file /etc/modprobe.conf, all config files belong into /etc/modprobe.d/.
Starting NFS services:  [  OK  ]
Starting NFS quotas: [  OK  ]
Starting NFS daemon: [  OK  ]
Starting NFS mountd: [  OK  ]
portmap 服务没有起来。因为在RHEL6中,使用rpcbind替换了RHEL5中NFS依赖的portmap服务,所以找不到portmap服务。
root@rac1 # service portmap start
portmap: unrecognized service
启动rpcbind
root@rac1 # /etc/init.d/rpcbind start
root@rac1 # netstat -ntlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name   
tcp        0      0 0.0.0.0:42251               0.0.0.0:*                   LISTEN      6451/rpc.mountd     
tcp        0      0 0.0.0.0:875                 0.0.0.0:*                   LISTEN      6435/rpc.rquotad    
tcp        0      0 0.0.0.0:111                 0.0.0.0:*                   LISTEN      1361/rpcbind        
tcp        0      0 0.0.0.0:51954               0.0.0.0:*                   LISTEN      1379/rpc.statd      
tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN      1514/sshd           
tcp        0      0 0.0.0.0:57949               0.0.0.0:*                   LISTEN      -                   
tcp        0      0 0.0.0.0:20351               0.0.0.0:*                   LISTEN      1578/python         
tcp        0      0 0.0.0.0:2049                0.0.0.0:*                   LISTEN      -                   
tcp        0      0 :::111                      :::*                        LISTEN      1361/rpcbind        
tcp        0      0 :::22                       :::*                        LISTEN      1514/sshd           
tcp        0      0 :::38359                    :::*                        LISTEN      -                   
tcp        0      0 :::42918                    :::*                        LISTEN      1379/rpc.statd
nfs相关服务:
* rpc.mountd - 这个进程接受来自NFS客户端的加载请求和验证请求的文件系统正在被输出.这个进程由NFS服务自动启动,不需要用户的配置.
* rpc.nfsd - 这个进程是NFS服务器.它和Linux核心一起工作来满足NFS客户端的动态需求,例如提供为每个NFS客户端的每次请求服务器线程.这个进程对应于nfs服务.
* rpc.lockd - 一个可选的进程,它允许NFS客户端在服务器上对文件加锁.这个进程对应于nfslock服务.
* rpc.statd - 这个进程实现了网络状态监控(NSM)RPC协议,通知NFS客户端什么时候一个NFS服务器非正常重启动.这个进程被nfslock服务自动启动,不需要用户的配置.
* rpc.rquotad - 这个进程对于远程用户提供用户配额信息. 这个进程被nfs服务自动启动,不需要用户的配置.
注意:
        对于使用nfs的机器down机重启 要确定 nfs 服务是否起来,并且到使用此机器的客户端机器确定挂载的目录是否mount以免影响生产使用。