NFS學習小結
系統環境:
[root@nfs-client2 ~]# cat /etc/redhat-release
CentOS release 6.7 (Final)
[root@nfs-client2 ~]#
[root@nfs-client2 ~]# uname -r
2.6.32-573.el6.x86_64
[root@nfs-client2 ~]# uname -m
x86_64
[root@nfs-client2 ~]# rpm -qa nfs-utils rpcbind
[root@nfs-client2 ~]# yum install nfs-utils rpcbind -y
………..
已安裝:
nfs-utils.x86_64 1:1.2.3-64.el6 rpcbind.x86_64 0:0.2.0-11.el6
作為依賴被安裝:
keyutils.x86_64 0:1.4-5.el6 libevent.x86_64 0:1.4.13-4.el6
libgssglue.x86_64 0:0.1-11.el6 libtirpc.x86_64 0:0.2.1-10.el6
nfs-utils-lib.x86_64 0:1.1.5-11.el6 python-argparse.noarch 0:1.2.1-2.1.el6
完畢!
[root@nfs-client2 ~]# rpm -qa nfs-utils rpcbind
nfs-utils-1.2.3-64.el6.x86_64
rpcbind-0.2.0-11.el6.x86_64
[root@nfs-server ~]# /etc/init.d/rpcbind status
rpcbind 已停
[root@nfs-server ~]# /etc/init.d/rpcbind start
正在啟動 rpcbind: [確定]
[root@nfs-server ~]# /etc/init.d/rpcbind status
rpcbind (pid 27104) 正在執行…
[root@nfs-server ~]# lsof -i :111
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
rpcbind 27104 rpc 6u IPv4 31439 0t0 UDP *:sunrpc
rpcbind 27104 rpc 8u IPv4 31442 0t0 TCP *:sunrpc (LISTEN)
rpcbind 27104 rpc 9u IPv6 31444 0t0 UDP *:sunrpc
rpcbind 27104 rpc 11u IPv6 31447 0t0 TCP *:sunrpc (LISTEN)
[root@nfs-server ~]# netstat -lntup|grep rpcbind
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 27104/rpcbind
tcp 0 0 :::111 :::* LISTEN 27104/rpcbind
udp 0 0 0.0.0.0:991 0.0.0.0:* 27104/rpcbind
udp 0 0 0.0.0.0:111 0.0.0.0:* 27104/rpcbind
udp 0 0 :::991 :::* 27104/rpcbind
udp 0 0 :::111 :::* 27104/rpcbind
[root@nfs-server ~]# chkconfig –list rpcbind
rpcbind 0:關閉 1:關閉 2:啟用 3:啟用 4:啟用 5:啟用 6:關閉
[root@nfs-server ~]# rpcinfo -p localhost
program vers proto port service
100000 4 tcp 111 portmapper
100000 3 tcp 111 portmapper
100000 2 tcp 111 portmapper
100000 4 udp 111 portmapper
100000 3 udp 111 portmapper
100000 2 udp 111 portmapper
[root@nfs-server ~]# /etc/init.d/nfs status
rpc.svcgssd 已停
rpc.mountd 已停
nfsd 已停
rpc.rquotad 已停
[root@nfs-server ~]# /etc/init.d/nfs start
啟動 NFS 服務: [確定]
關掉 NFS 配額: [確定]
啟動 NFS mountd: [確定]
啟動 NFS 守護程式: [確定]
正在啟動 RPC idmapd: [確定]
[root@nfs-server ~]# netstat -lntup|grep 2049 ——nfs主埠
tcp 0 0 0.0.0.0:2049 0.0.0.0:* LISTEN –
tcp 0 0 :::2049 :::* LISTEN –
udp 0 0 0.0.0.0:2049 0.0.0.0:* –
udp 0 0 :::2049 :::* –
[root@nfs-server ~]# rpcinfo -p localhost
program vers proto port service
100000 4 tcp 111 portmapper
100000 3 tcp 111 portmapper
100000 2 tcp 111 portmapper
100000 4 udp 111 portmapper
100000 3 udp 111 portmapper
100000 2 udp 111 portmapper
100011 1 udp 875 rquotad
100011 2 udp 875 rquotad
100011 1 tcp 875 rquotad
100011 2 tcp 875 rquotad
100005 1 udp 40562 mountd
100005 1 tcp 43893 mountd
100005 2 udp 53127 mountd
100005 2 tcp 36081 mountd
100005 3 udp 56672 mountd
100005 3 tcp 52133 mountd
100003 2 tcp 2049 nfs
100003 3 tcp 2049 nfs
100003 4 tcp 2049 nfs
100227 2 tcp 2049 nfs_acl
100227 3 tcp 2049 nfs_acl
100003 2 udp 2049 nfs
100003 3 udp 2049 nfs
100003 4 udp 2049 nfs
100227 2 udp 2049 nfs_acl
100227 3 udp 2049 nfs_acl
100021 1 udp 42438 nlockmgr
100021 3 udp 42438 nlockmgr
100021 4 udp 42438 nlockmgr
100021 1 tcp 36179 nlockmgr
100021 3 tcp 36179 nlockmgr
100021 4 tcp 36179 nlockmgr
加入開機自啟動:
[root@nfs-server ~]# cat /etc/rc.local
……
/etc/init.d/rpcbind start
/etc/init.d/nfs start
[root@nfs-server ~]# ps -ef|egrep “nfs|rpc”
rpc 27104 1 0 10:35 ? 00:00:00 rpcbind
root 27208 2 0 10:44 ? 00:00:00 [rpciod/0]
root 27209 2 0 10:44 ? 00:00:00 [rpciod/1]
root 27218 1 0 10:44 ? 00:00:00 rpc.rquotad 磁碟配額進城
root 27223 1 0 10:44 ? 00:00:00 rpc.mountd 許可權管理驗證
root 27230 2 0 10:44 ? 00:00:00 [nfsd4]
root 27231 2 0 10:44 ? 00:00:00 [nfsd4_callbacks]
root 27232 2 0 10:44 ? 00:00:00 [nfsd] =====>nfs主程式
root 27233 2 0 10:44 ? 00:00:00 [nfsd] =====>nfs主程式
root 27234 2 0 10:44 ? 00:00:00 [nfsd] =====>nfs主程式
root 27235 2 0 10:44 ? 00:00:00 [nfsd]
root 27236 2 0 10:44 ? 00:00:00 [nfsd]
root 27237 2 0 10:44 ? 00:00:00 [nfsd]
root 27238 2 0 10:44 ? 00:00:00 [nfsd]
root 27239 2 0 10:44 ? 00:00:00 [nfsd]
root 27270 1 0 10:44 ? 00:00:00 rpc.idmapd
root 27299 2056 0 10:54 pts/1 00:00:00 grep -E nfs|rpc
[root@nfs-server ~]# mkdir /data
[root@nfs-server ~]# cat /etc/exports
/data 10.0.0.*(rw,sync)
[root@nfs-server ~]# /etc/init.d/nfs reload 重新載入服務
[root@nfs-server ~]# showmount -e 127.0.0.1 ======>檢視共享的記錄
Export list for 127.0.0.1:
/data 10.0.0.*
[root@nfs-server ~]# mount -t nfs 10.0.0.7:/data /mnt 將/data目錄掛載到/mnt下面
[root@nfs-server ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 19G 1.5G 16G 9% /
tmpfs 937M 0 937M 0% /dev/shm
/dev/sda1 190M 36M 145M 20% /boot
10.0.0.7:/data 19G 1.5G 16G 9% /mnt ======>已掛載成功
[root@nfs-server mnt]# touch /data/oldboy.txt
[root@nfs-server mnt]# ll /data/
總用量 0
-rw-r–r– 1 root root 0 11月 23 11:16 oldboy.txt
[root@nfs-client1 ~]# /etc/init.d/rpcbind start
正在啟動 rpcbind: [確定]
[root@nfs-client1 ~]# chkconfig rpcbind on
[root@nfs-client1 ~]# showmount -e 10.0.0.7
Export list for 10.0.0.7:
/data 10.0.0.0/24
客戶端掛載:
[root@nfs-client1 ~]# mount -t nfs 10.0.0.7:/data /mnt
[root@nfs-client1 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 19G 1.5G 16G 9% /
tmpfs 937M 0 937M 0% /dev/shm
/dev/sda1 190M 36M 145M 20% /boot
10.0.0.7:/data 19G 1.5G 16G 9% /mnt
[root@nfs-server data]# touch oldboy.txt =======>服務端建立一個檔案oldboy.txt
[root@nfs-server data]# ll
總用量 0
-rw-r–r– 1 root root 0 11月 23 11:25 oldboy.txt
[root@nfs-client1 mnt]# ll
總用量 0
-rw-r–r– 1 root root 0 11月 23 11:25 oldboy.txt ======>客戶端檢視是存在的
[root@nfs-client1 mnt]# touch abc.txt ======>在客戶端沒有寫的許可權
touch: 無法建立”abc.txt”: 許可權不夠
出現此問題在於許可權不對,伺服器端需要對此目錄進行授權,許可權為nfsnobody
[root@nfs-server data]# chown -R nfsnobody /data/ ======>授權服務端對/data具有寫許可權
[root@nfs-server data]# ll /data/
總用量 0
-rw-r–r– 1 nfsnobody root 0 11月 23 11:25 oldboy.txt ======>屬主許可權已改
然後再在客戶端建立
[root@nfs-client1 mnt]# touch abc.txt =======>客戶端已能夠成功建立檔案
[root@nfs-client1 mnt]#
[root@nfs-client2 ~]# /etc/init.d/rpcbind start
正在啟動 rpcbind: [確定]
[root@nfs-client2 ~]# chkconfig rpcbind on
[root@nfs-client2 ~]# mount -t nfs 10.0.0.7:/data /mnt =======>掛載
[root@nfs-client2 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 19G 1.5G 16G 9% /
tmpfs 937M 0 937M 0% /dev/shm
/dev/sda1 190M 36M 145M 20% /boot
10.0.0.7:/data 19G 1.5G 16G 9% /mnt =======>已掛載成功
[root@nfs-client2 mnt]# touch 9.txt
[root@nfs-client1 mnt]# ll
-rw-r–r– 1 nfsnobody nfsnobody 0 11月 23 11:41 9.txt
[root@nfs-server data]# rm -f 9.txt
已刪除。
結論:無論在哪個nfs目錄下建立檔案,其他客戶端都能夠進行刪除,解決了共享儲存問題。
檢查思路:
1 ping
2 telnet
3 出現no route to host,則必須要檢查防火牆和安全策略
4 showmount
相關文章
- 學習小結
- vue 學習小結Vue
- JavaScript學習小結JavaScript
- 小程式學習總結
- git學習小總結Git
- CommonsChunkPlugin學習小結Plugin
- 整合學習原理小結
- Spring 學習小結Spring
- qDebug 學習小結
- HTML5 學習小結HTML
- Activiti 學習筆記 小結筆記
- Thrift-java學習小結Java
- awk指令碼學習小結指令碼
- Android:Sqlitedatabase學習小結AndroidSQLiteDatabase
- WebPack持久快取學習小結Web快取
- Vue1.0學習小結2Vue
- 《angular 權威教程》學習小結Angular
- 不確定估計學習小結
- Nginx支援WebSocket反向代理-學習小結NginxWeb
- redis執行緒模型-學習小結Redis執行緒模型
- 學習vue第一階段小結Vue
- Android學習之 WebView使用小結AndroidWebView
- 7.15--7.19學習小結
- 【C#學習之辨析小總結】C#
- Nginx code 常用狀態碼學習小結Nginx
- 跟小師父學習QTP後的總結QT
- 軟體測試工具QTP學習小結QT
- 【NFS】linux NFS "unmatched host" 異常小測試NFSLinux
- 前端學習小結(一)—基礎入門篇前端
- RMAN學習小結1:不完全恢復
- 【資料結構】第六章學習小結--- 圖資料結構
- 學習git以及github自己的一點小總結:Github
- 2020-10-28 學習小結(七)
- 2020-10-20 學習小結(四)
- Activiti 學習筆記一到六小結筆記
- 整合學習之Adaboost演算法原理小結演算法
- SQLite資料庫學習小結——Frameworks層實現SQLite資料庫Framework
- 結對程式設計——小學四則運算練習題小程式程式設計