NFS
14.1 NFS介紹
- NFS是Network File System的縮寫
- NFS最先由Sun公司開發,分2,3,4三個版本,2和3由Sun起草開發,4.0開始Netapp公司參與並主導開發,最新爲4.1版本
- NFS數據傳輸基於RPC協議,RPC爲Remote Procedure Call的簡寫。
- NFS應用場景是:A,B,C三臺機器上須要保證被訪問到的文件是同樣的,A共享數據出來,B和C分別去掛載A共享的數據目錄,從而B和C訪問到的數據和A上的一致
- NFS架構

- NFS原理圖

14.2 NFS服務端安裝配置
- yum install -y nfs-utils rpcbind
- vim /etc/exports //加入以下內容 /home/nfstestdir 192.168.133.0/24(rw,sync,all_squash,anonuid=1000,anongid=1000) 保存配置文件後,執行以下準備操做
- mkdir /home/nfstestdir
- chmod 777 /home/nfstestdir
- systemctl start rpcbind
- systemctl start nfs
- systemctl enable rpcbind
- systemctl enable nfs
14.3 NFS配置選項
- rw 讀寫
- ro 只讀
- sync 同步模式,內存數據實時寫入磁盤
- async 非同步模式
- no_root_squash 客戶端掛載NFS共享目錄後,root用戶不受約束,權限很大
- root_squash 與上面選項相對,客戶端上的root用戶收到約束,被限定成某個普通用戶
- all_squash 客戶端上全部用戶在使用NFS共享目錄時都被限定爲一個普通用戶
- anonuid/anongid 和上面幾個選項搭配使用,定義被限定用戶的uid和gid
歡迎關注本站公眾號,獲取更多信息