標籤:共用資源 軟體包 客戶機 開發 網路
NFS共用儲存
NFS是一種基於TCP/IP傳輸的網路檔案系統協議,有SUN公司開發,通過使用NFS協議,客戶機可以像訪問本地目錄一樣訪問遠程主機中的資源。在負載平衡群集中,使用NFS是比較常見的做法,NFS也是NAS存放裝置必然支援的一種協議。
3.1 使用NFS發布共用資源
NFS服務的實現依賴於RPC(Remote Process Call)機制,已完成遠程到本地的映射過程。需要安裝nfs-utils、rpcbind軟體包來提供nfs服務,前者用於NFS共用發布和訪問,後者用於PRC支援。
(1)安裝nfs-tuils、rpcbind
手動載入NFS共用服務時,應該先啟動rpcbind、然後再啟動NFS服務。
650) this.width=650;" style="border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px" title="clip_image002" border="0" alt="clip_image002" src="http://s3.51cto.com/wyfs02/M02/7F/74/wKiom1cfEcSw-uU9AAAlU_tN_mQ713.jpg" "554" height="50" />
啟動服務:
650) this.width=650;" style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px" title="clip_image004" border="0" alt="clip_image004" src="http://s3.51cto.com/wyfs02/M01/7F/74/wKiom1cfEfTBTMNvAAA_RqfiQnE260.jpg" "554" height="117" />
設定開機自啟:
650) this.width=650;" style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px" title="clip_image006" border="0" alt="clip_image006" src="http://s3.51cto.com/wyfs02/M00/7F/74/wKiom1cfEgCwIq3pAABVvz5uISo401.jpg" "554" height="98" />
(2)設定共用目錄
NFS的設定檔為/etc/exports,檔案內容預設為空白,也就是無任何共用內容。共用格式:“目錄位置 客戶機地址(許可權控制)”
650) this.width=650;" style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px" title="clip_image008" border="0" alt="clip_image008" src="http://s3.51cto.com/wyfs02/M01/7F/74/wKiom1cfEgSxfS_BAAAo-AFMMgg007.jpg" "554" height="50" />
(3)重新啟動服務
650) this.width=650;" style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px" title="clip_image010" border="0" alt="clip_image010" src="http://s3.51cto.com/wyfs02/M02/7F/74/wKiom1cfEg6hZtQUAAB9pgAQwUE597.jpg" "554" height="261" />
(4)查看本機NFS共用目錄
650) this.width=650;" style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px" title="clip_image012" border="0" alt="clip_image012" src="http://s3.51cto.com/wyfs02/M02/7F/72/wKioL1cfEtyQE_UDAAAnzT2caEY927.jpg" "553" height="53" />
(5)防火牆問題,因為nfs協議較為特殊,連接埠動態,不方便添加防火牆規則,解決方案如下:
650) this.width=650;" style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px" title="clip_image014" border="0" alt="clip_image014" src="http://s3.51cto.com/wyfs02/M00/7F/74/wKiom1cfEhfyMhDNAAAjCqM-8qM914.jpg" "553" height="59" />
設定防火牆規則:
650) this.width=650;" style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; border-top: 0px; border-right: 0px; padding-top: 0px" title="clip_image016" border="0" alt="clip_image016" src="http://s3.51cto.com/wyfs02/M00/7F/72/wKioL1cfEuyh1y5-AAByGclPuj0183.jpg" "554" height="113" />
並使用“service iptables save”儲存規則
NFS共用儲存