nfs
# 依赖rpc服务通信 portmap[centos5] 或 rpcbind[centos6]
yum install nfs-utils portmap # centos5安装
yum install nfs-utils rpcbind # centos6安装
vim /etc/exports # 配置文件
# sync # 同步写入
# async # 暂存并非直接写入
# no_root_squash # 开放用户端使用root身份操作
# root_squash # 使用者身份为root则被压缩成匿名使用,即nobody,相对安全
# all_squash # 所有NFS的使用者身份都被压缩为匿名
/data/images 10.10.10.0/24(rw,sync,no_root_squash)
service portmap restart # 重启centos5的nfs依赖的rpc服务
service rpcbind restart # 重启centos6的nfs依赖的rpc服务
service nfs restart # 重启nfs服务 确保依赖 portmap 或 rpcbind 服务已启动
service nfs reload # 重载NFS服务配置文件
showmount -e # 服务端查看自己共享的服务
showmount -a # 显示已经与客户端连接上的目录信息
showmount -e 10.10.10.3 # 列出服务端可供使用的NFS共享 客户端测试能否访问nfs服务
mount -t nfs 10.10.10.3:/data/images/ /data/img # 挂载nfs 如果延迟影响大加参数 noac
# 服务端的 portmap 或 rpcbind 被停止后,nfs仍然工作正常,但是umout财会提示: not found / mounted or server not reachable 重启服务器的portmap 或 rpcbind 也无济于事。 nfs也要跟着重启,否则nfs工作仍然是不正常的。
# 同时已挂载会造成NFS客户端df卡住和挂载目录无法访问。请先用 mount 查看当前挂载情况,记录挂载信息,在强制卸载挂载目录,重新挂载
umount -f /data/img/ # 强制卸载挂载目录 如还不可以 umount -l /data/img/
nfsstat -c # 客户机发送和拒绝的RPC和NFS调用数目的信息
nfsstat -cn # 显示和打印与客户机NFS调用相关的信息
nfsstat -r # 显示和打印客户机和服务器的与RPC调用相关的信息
nfsstat –s # 显示关于服务器接收和拒绝的RPC和NFS调用数目的信息
}
文档更新时间: 2018-11-21 16:01 作者:RuM