名字就叫"nfs"-(network file system)

來源:互聯網
上載者:User

標籤:nfs   rpc   網路檔案系統   rpcbind配置   

一、簡介  

    NFS(network file system)網路檔案系統。通過網路讓不同的主機系統之間可以實現檔案或目錄共用。分為用戶端和伺服器,NFS網路檔案系統很像windows系統的網際網路共用、安全功能、網路磁碟機和Samba服務類似。


二、安裝及其配置

伺服器端配置如下:

1)安裝nfs-utils和rpcbind兩包

yum -y install nfs-utils rpcbind   

2)啟動服務

service nfs start或/etc/init.d/nfs start    /etc/init.d/rpcbind  start  

3)檢查服務是否開啟  

netstat -tnl|grep 111  netstat -tnl|grep 2049     

[[email protected] ~]# netstat -tnl|grep 111tcp        0      0 0.0.0.0:111                 0.0.0.0:*                   LISTENtcp        0      0 :::111                      :::*                        LISTEN[[email protected] ~]# netstat -tnl|grep 2049tcp        0      0 0.0.0.0:2049                0.0.0.0:*                   LISTENtcp        0      0 :::2049                     :::*                        LISTEN[[email protected] ~]# lsof -i :111COMMAND  PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAMErpcbind 1708  rpc    6u  IPv4  13514      0t0  UDP *:sunrpcrpcbind 1708  rpc    8u  IPv4  13517      0t0  TCP *:sunrpc (LISTEN)rpcbind 1708  rpc    9u  IPv6  13519      0t0  UDP *:sunrpcrpcbind 1708  rpc   11u  IPv6  13522      0t0  TCP *:sunrpc (LISTEN)[[email protected] ~]#

4)建立共用目錄並寫入設定檔
vi /etc/exports      

/data    10.1.0.0/16(rw,sync,no_root_squash)

5)測試是否成功  

showmount -e localhost     


客服端配置如下:

1)安裝nfs-utils和rpcbind兩包

yum -y install nfs-utils rpcbind   

2)啟動服務,只開啟rpcbind即可  

/etc/init.d/rpcbind  start  

3)檢查服務是否開啟

netstat -tnl|grep 111  

4)測試是否生效

showmount -e 10.1.2.2

5)建立掛載點及掛載 

mkdir /mnt/data   

mount 10.1.2.2:/data /mnt/data    



三、綜合測試

分別在伺服器端及其客服端的/data目錄進行建立目錄或檔案查看是否同步生效即可。  



四、命令總結及設定檔說明

showmount命令:

 -e: 在nfs用戶端執行,探查某主機所匯出的nfs檔案系統;使用格式“showmount -e Server_IP”;

  -d: 在nfs伺服器端執行,顯示哪個匯出的檔案系統已經被至少一個客戶掛載使用了;

  -a: 在nfs伺服器端顯示所有的掛載會話;


exportfs命令:

  -a: 操作所有檔案系統

 -ra: 重新匯出所有檔案系統

 -ua: 取消匯入的所有檔案系統

 -v: 顯示詳細資料




設定檔/etc/exports參數說明: 


設定檔格式:

檔案系統 用戶端1(檔案系統匯出屬性)     用戶端2(檔案系統匯出屬性) 


檔案系統

用戶端:IP: 172.16.100.8  Hostname: *.magedu.com  Network: 


檔案系統匯出屬性:

rw,ro:讀寫、唯讀  

sync:同步

async:非同步

roo_squash:壓縮用root使用者為匿名使用者,即為nfsnobody使用者   

no_root_squash:不壓縮使用者  

all_squash:壓縮所有使用者  

anonuid, anongid: 指定匿名使用者映射為的UID和GID;









本文出自 “小耳朵” 部落格,請務必保留此出處http://purify.blog.51cto.com/10572011/1852842

名字就叫"nfs"-(network file system)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.