一 NFS介紹
linux
屬於網絡文件系統,它是unix,linux標準協議,開源的標準擴展協議,支持nfsv4。NFS傳輸使用的是遠程過程調用RPC機制安全
二 NFS安裝和配置服務器
yum -y install nfs-utils網絡
yum -y install rpc.mountd portmap架構
systemctl enable nfs-secureoracle
mkdir /mountpointasync
mount serverX:/ /mountpointide
2.查看工具
showmount -e serverX性能
3.nfsmount setup
4.自動掛載autofs
yum -y install autofs
/etc/auto.master.d
vi /etc/auto.master.d/demo.autofs
vi /etc/auto.direct
/mnt/docs -rw,sync,krb2p serverX:/shares/docs
vi /etc/auto.master.d/shares.autofs
/shares /etc/auto.shares
* -rw,sync,sec=krb5p serverX:/shares/&
systemctl enable autofs
systemctl start autofs
5.配置
vi /etc/exports
/myshare server0.example.com
/myshare disk(rw,no_root_squash)
systemctl start nfs-server
exportfs -r
firewall-cmd --permanent --add-service=nfs
firewall-cmd --reload
5.2 參考命令
ro 只讀
rw 讀寫
sync 全部數據在請求時寫入共享
async NFS在寫入數據前能夠相應請求
secure NFS經過1024如下的安全TCP/IP端口發送
insecure 1024以上
wdelay 若是多個用戶要寫入NFS目錄,則規組寫入默認
no_wdelay
hide 在NFS共享目錄中不共享子目錄
no_hide 共享NFS目錄的子目錄
subtree_check 若是共享/usr/bin之類的子目錄時,強制檢查權限
all_squash 共享文件的UID和GID映射到匿名用戶,適合公共目錄
no_all_squash 保留共享文件的UID和GID
root_squash root全部請求映射成如 anonymouns
anonuid=xxx 指定NFS服務器passwd文件的匿名ID
三 NFS案例
案例:nfs服務器共享了3個目錄,一個是 share,一個是data,一個是public,須要按照下面要求實現相應功能:
a 發佈share目錄,全部均可以讀寫
b 發佈data目錄,只容許oracle用戶能夠讀寫
c 發佈public,全部人只能夠讀,沒法寫
四 NFS 性能
4.1 使用測試工具作性能測試
iozone
fio
五 NFS 高可用
六 問題
6.1 nfs自啓動是否能夠放入到fstab裏面