nfs搭建和可能的問題
http://www.cnblogs.com/hackerer/p/5221556.html
挺不錯的參考文件
NFS伺服器搭建:
伺服器IP: 10.135.152.241
yum install rpcbind nfs-utils
# cat /etc/exports
/nfs_data 10.104.71.154(rw,no_root_squash,no_all_squash,sync)
#/nfs_data 172.16.1.0/24(rw,sync,all_squash)
# mkdir /nfs_data
# chown -R nfsnobody.nfsnobody /nfs_data
說明: 該使用者在安裝nfs時就建立好了
# /etc/init.d/rpcbind start
# /etc/init.d/nfs start
# /etc/init.d/nfs status/reload/stop/restart
啟動命令加到/etc/rc.local
/etc/init.d/rpcbind start
/etc/init.d/nfs start
啟動nfs可能會遇到的問題:
# /etc/init.d/nfs start
Starting NFS services: [ OK ]
Starting NFS quotas: Cannot register service: RPC: Unable to receive; errno = Connection refused
rpc.rquotad: unable to register (RQUOTAPROG, RQUOTAVERS, udp).
[FAILED]
Starting NFS mountd: [FAILED]
Starting NFS daemon: rpc.nfsd: writing fd to kernel failed: errno 111 (Connection refused)
rpc.nfsd: unable to set any sockets for nfsd
[FAILED]
原因:
RH系作業系統在6.0版本號之後沒有portmap服務控制rpc的啟動。因為NFS和nfslock的啟動須要向rpc進行註冊,rpc不啟動的話就會報錯。
解決方法:啟動rpcbind&rpcidmap rpcbind是6.0版本號後預設的RPC服務,所以要先於nfs啟動。假設不啟動rpcidmap則會造成使用者許可權的對映錯誤,使用者的許可權看起來是一串數字。
# /etc/init.d/rpcbind start
Starting rpcbind: [ OK ]
# /etc/init.d/rpcidmapd start
Starting RPC idmapd: [ OK ]
# /etc/init.d/nfs start
Starting NFS services: [ OK ]
Starting NFS quotas: [ OK ]
Starting NFS mountd: [ OK ]
Starting NFS daemon: [ OK ]
# cat /var/lib/nfs/etab
/data001/data/sites/imgdsp.100msh.com 10.104.71.154(rw,sync,wdelay,hide,nocrossnfs_data,secure,no_root_squash,no_all_squash,no_subtree_check,secure_locks,acl,anonuid=65534,anongid=65534,sec=sys,rw,no_root_squash,no_all_squash)
/data001/data/sites/imgdsp.100msh.com 10.104.35.202(rw,sync,wdelay,hide,nocrossnfs_data,secure,no_root_squash,no_all_squash,no_subtree_check,secure_locks,acl,anonuid=65534,anongid=65534,sec=sys,rw,no_root_squash,no_all_squash)
10.135.152.241是NFS伺服器地址
# showmount -e 10.135.152.241 <==掛載前首先檢查有許可權需要掛載的資訊
Export list for 10.135.152.241:
/data 10.135.152.241/24 <—可以看到共享/data目錄
本機做掛載測試
# mount -t nfs 10.135.152.241:/data /mnt ##將/data共享目錄掛載到本地的/mnt目錄
# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 7.1G 1.5G 5.3G 22% /
tmpfs 279M 0 279M 0% /dev/shm
/dev/sda1 190M 36M 145M 20% /boot
10.135.152.241:/data 7.1G 1.5G 5.3G 22% /mnt
掛載nfs
# yum -y install nfs-utils rpcbind
# /etc/init.d/rpcbind start
Starting rpcbind: [ OK ]
mount -t nfs 10.135.152.241:/nfs_data /nfs_data
可能會遇到的問題:
mount: wrong fs type, bad option, bad superblock on 10.135.152.241:/data/img,
missing codepage or helper program, or other error
(for several filesystems (e.g. nfs, cifs) you might
need a /sbin/mount.<type> helper program)
In some cases useful info is found in syslog – try
dmesg | tail or so
原因:
[root@web data]# ll /sbin/mount*
檢視/sbin/mount.<type>檔案,果然發現沒有/sbin/mount.nfs的檔案,安裝nfs-utils即可
解決:
yum install nfs-utils
掛載成功後測試共享目錄的讀,寫
mount掛載效能優化引數選項
(1)禁止更新目錄及檔案時間戳掛載
mount -t nfs -o noatime,nodiratime 10.135.152.241:/data
(2)安全加優化的掛載方式
mount -t nfs -o nosuid,noexec,nodev,noatime,nodiratime,intr,rsize=131072,wsize=131072 10.135.152.241:/nfs_data /mnt
(3)預設的掛載方式
mount -t nfs 10.135.152.241:/nfs_data /mnt
NFS核心優化
編輯/etc/sysctl.conf
net.core.wmem_default = 8388608
net.core.rmem_default = 8388608
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
# sysctl -p
其他問題:
【LINUX】在redhat6系統中 當NFS啟動後 rpc.svcgssd 狀態還是STOP
[root@mytest Packages]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.7 (Santiago)
[root@mytest Packages]# service rpcbind status
rpcbind (pid 4744) is running…
[root@mytest Packages]# service nfs status
rpc.svcgssd is stopped — 問題所在
rpc.mountd (pid 5733) is running…
nfsd (pid 5749 5748 5747 5746 5745 5744 5743 5742) is running…
rpc.rquotad (pid 5728) is running…
描述:如果NFS 配置為Kerberos 自動共享模式,該服務才會有用或者啟動
原文如下:
This is an expected behaviour. rpc.svcgssd and rpc.gssd daemons only needs to be enabled if NFS is configured to to export shares via Kerberos authentication
NFS 預設是不配置Kerberos 共享 的
NFS service by default is not configured to export shares via Kerberos
Kerberos協議:(此處解釋轉載自http://www.jb51.net/article/94875.htm)
Kerberos協議主要用於計算機網路的身份鑑別(Authentication), 其特點是使用者只需輸入一次身份驗證資訊就可以憑藉此驗證獲得的票據(ticket-granting ticket)訪問多個服務,即SSO(Single Sign On)。由於在每個Client和Service之間建立了共享金鑰,使得該協議具有相當的安全性。
在client上執行:
showmount -e cloud.squirrel.org
clnt_create: RPC: Port mapper failure – Unable to receive: errno 111 (Connection refused)
showmount -e 192.168.205.129
Export list for 192.168.205.129:
/export *
mount -t nfs cloud.squirrel.org:/export/primary /primarymount
mount.nfs: Connection timed out
mount -t nfs 192.168.205.129:/export/primary /primarymount
mount.nfs: access denied by server while mounting 192.168.205.129:/export/primary
到server去tail -200 /var/log/messages:
refused mount request from 192.168.205.1 for /export/primary (/export): illegal port 1024
已經快接近成功了,google了一下,說是server上nfs要加上一個insecure:
gedit /etc/exports
在原來的那一行上修改如下:
/export *(rw,async,insecure,no_root_squash)
然後:
exportfs -rv
service nfs restart
在client上重新
mount -t nfs 192.168.205.129:/export/primary /primarymount
沒有提示,應該成功了,可以確認:
mount |grep primary
OK!
相關文章
- nfs伺服器搭建和遇到的問題NFS伺服器
- expdp over nfs 問題解決NFS
- 配置nfs伺服器出現的問題NFS伺服器
- openldap+NFS 鎖問題解決LDANFS
- ORA-27054: NFS 問題處理NFS
- 使用nfs作為歸檔目錄的問題NFS
- 你可能忽略的多型問題多型
- 密碼找回功能可能存在的問題密碼
- Atx可能要解決的問題
- 大資料面試可能遇到的問題大資料面試
- 解決umount.nfs: /data: device is busy 問題NFSdev
- 前端面試中可能會問到的問題(一)前端面試
- 微搭低程式碼x騰訊問卷:搭建問卷定製化應用的更多可能性
- MySQL 你可能忽視的選擇問題MySql
- iOS CocoaPods 安裝可能遇到的問題iOS
- 交換機可能產生的問題分析(轉)
- NFS奇怪問題1 - NFS無法工作,服務重啟失敗,掛載目錄變成問號。NFS
- Linux 萬用字元可能產生的問題Linux字元
- 密碼找回功能可能存在的問題(補充)密碼
- PHPer、Laravel 面試可能會遇到的問題及答案PHPLaravel面試
- JS中缺少分號可能引發的問題JS
- 面試可能會遇到的各種問題講解面試
- numa 架構下mysql可能遭遇的swap問題架構MySql
- 接上條,問題可能是Oracle新出的BUGOracle
- 單例模式中的DDCP可能出現的問題單例模式
- PHP Session可能會引起併發問題PHPSession
- 單例模式中可能存在的一些問題(執行緒安全問題)單例模式執行緒
- 新MacBook Pro問題頻發 可能是顯示卡出現問題Mac
- 關於CSS中的float可能出現的小問題CSS
- Python面試你可能會被問到的面試題Python面試題
- SSH無密碼驗證可能出現的問題密碼
- Oracle資料庫導致效能問題的可能原因Oracle資料庫
- Q&A:「微搭低程式碼」計費相關問題
- Oracle安全:SCN可能最大值與耗盡問題Oracle安全:SCN可能最大值與耗盡問題Oracle
- 面試中可能會被問到的幾個關於“委託”的問題面試
- 使用Disruptor 遇到問題,eventHander可能讀不到事件事件
- air在go的其他版本上執行可能遇到的問題AIGo
- ORACLE RAC TO RAC DG搭建過程中可能遇到的問題Oracle