1.在NFS服务器A上共享 /data/w_shared
及 /data/r_shared
两个文件目录,允许从NFS客户端B,C上分别挂载共享目录后实现从B,C上只读/data/r_shared
,可写/data/w_shared
。
2.NFS客户端B上的挂载点为/data/b_w
(写),/data/b_r
(读)
3.NFS客户端C上的挂载点为/data/w_qzc
(写),/data/r_qzc
(读)
4.从NFS客户端B上的NFS可写挂载耟目录创建任意文件,从C上可以删除这个创建的文件,反之也可以。
#服务端配置
[root@zcjscl ~]# vim /etc/exports
添加
/data/w_shared 0.0.0.0/24(rw,sync)
/data/r_shared 0.0.0.0/24(ro)
[root@zcjscl ~]# mkdir /data/w_shared /data/r_shared -p
[root@zcjscl ~]# chown -R nfsnobody /data/w_shared/ /data/r_shared
[root@zcjscl ~]# /etc/init.d/rpcbind restart
[root@zcjscl ~]# /etc/init.d/nfs restart
[root@zcjscl ~]#chkconfig nfs on
[root@zcjscl ~]#chkconfig rpcbind on
[root@zcjscl ~]#/etc/init.d/iptables stop
[root@zcjscl ~]#getenforce
[root@zcjscl ~]#showmount -e 127.0.0.1 //测试
#B客户端配置,挂载
[root@zcjscl ~]#mkdir /data/{b_w,b_r} -p
[root@zcjscl ~]#showmount -e 192.168.1.99
[root@zcjscl ~]#/etc/init.d/rpcbind restart
[root@zcjscl ~]#chkconfig rpcbind on
[root@zcjscl ~]#mount -t nfs 192.168.1.99:/data/w_shared /data/b_w/
[root@zcjscl ~]#mount -t nfs 192.168.1.99:/data/r_shared /data/b_r/
[root@zcjscl ~]#df -h //检查
#C客户端配置,挂载
[root@zcjscl ~]#mkdir /data/{w_qzc,r_qzc} -p
[root@zcjscl ~]#showmount -e 192.168.1.99
[root@zcjscl ~]#/etc/init.d/rpcbind restart
[root@zcjscl ~]#chkconfig rpcbind on
[root@zcjscl ~]#mount -t nfs 192.168.1.99:/data/w_shared /w_qzc/
[root@zcjscl ~]#mount -t nfs 192.168.1.99:/data/r_shared /r_qzc/
[root@zcjscl ~]#df -h //检查
#挂载优化
读取限制 写入限制 不更新时间
rsize=32768,wsize=32768,intr,noatime
mount -t nfs -o rsize=32768,wsize=32768,intr,noatime 192.168.1.99:/data/w_shared /w_qzc/