使用nfs經驗談
一、場景:
在Linux上操作命令:
host3:/opt/oracle # id
uid=0(root) gid=0(root) groups=0(root),64(pkcs11)
host3:/opt/oracle # mount -t nfs 192.168.1.73:/opt/oracle/backup /opt/oracle/backup
mount server reported tcp not available, falling back to udp
mount: RPC:程式未註冊
host3:/opt/oracle #
二、分析步驟:
第1步:檢查對方伺服器是否做了連線限制
登入到對方伺服器 , 檢視/etc/hosts.allow 和 /etc/hosts.deny 檔案.其中hosts.deny 是拒絕了其中對應IP的主機的連線,hosts.allow 是允許其中對應IP主機的連線。
[root@hua73 ~]# tail /etc/hosts.allow
#
# hosts.allow This file describes the names of the hosts which are
# allowed to use the local INET services, as decided
# by the '/usr/sbin/tcpd' server.
#
[root@hua73 ~]# tail /etc/hosts.deny
#
# hosts.deny This file describes the names of the hosts which are
# *not* allowed to use the local INET services, as decided
# by the '/usr/sbin/tcpd' server.
#
# The portmap line is redundant, but it is left to remind you that
# the new secure portmap uses hosts.deny and hosts.allow. In particular
# you should know that NFS uses portmap!
從裡面內容可知,對方服務並未對他方主機的連線做任何限制。
第2步:是否是由相關服務未啟動導致:
檢查portmap服務、nfs服務。其中portmap服務是用來支援RPC連線,RPC被用於NFS以及NIS 等服務。
1、檢查portmap服務的狀態:
[root@hua73 ~]# service portmap status
portmap (pid 3285) is running...
說明portmap服務正常啟動執行。
2、檢查nfs服務的狀態:
[root@hua73 ~]# service nfs status
rpc.mountd is stopped
nfsd is stopped
rpc.rquotad is stopped
——nfs服務未啟動。
三、解決方法:
1、啟動nfs服務:
[root@hua73 ~]# service nfs start
Starting NFS services: [ OK ]
Starting NFS quotas: [ OK ]
Starting NFS daemon: [ OK ]
Starting NFS mountd: [ OK ]
2、重啟portmap服務:
[root@hua73 ~]#
[root@hua73 ~]# service portmap reload
Stopping portmap: [ OK ]
Starting portmap: [ OK ]
[root@hua73 ~]#
但執行命令還是不行:
host3:/opt/oracle # mount -t nfs 192.168.1.73:/opt/oracle/backup /opt/oracle/backup
mount: 192.168.1.73:/opt/oracle/backup failed, reason given by server: Permission denied
最後在exports中增加一行才解決問題
[root@hua73 etc]# vi exports
/opt/oracle/backup 192.168.1.53(rw,root_squash,sync)
~
~
~
~
~
~
~
"exports" 1L, 53C written
[root@hua73 etc]# service iptables status
Firewall is stopped.
[root@hua73 etc]#
[root@hua73 etc]#
[root@hua73 etc]#
[root@hua73 etc]#
[root@hua73 etc]#
[root@hua73 etc]#
[root@hua73 etc]# servicd nfs restart
-bash: servicd: command not found
[root@hua73 etc]# service nfs restart
Shutting down NFS mountd: [ OK ]
Shutting down NFS daemon: [ OK ]
Shutting down NFS quotas: [ OK ]
Shutting down NFS services: [FAILED]
Starting NFS services: [ OK ]
Starting NFS quotas: [ OK ]
Starting NFS daemon: [ OK ]
Starting NFS mountd: [ OK ]
[root@hua73 etc]# cat exports
/opt/oracle/backup 192.168.1.53(rw,root_squash,sync)
[root@hua73 etc]# ls -l exports
-rw-r--r-- 1 root root 53 Dec 12 10:44 exports
[root@hua73 etc]# date
Thu Dec 12 10:55:27 CST 2013
[root@hua73 etc]#
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26870952/viewspace-1063358/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- TurboLinux使用經驗談(轉)Linux
- CVS使用經驗談 (轉)
- 經驗談
- GCD使用經驗與技巧淺談GC
- 經驗談集
- DBA 經驗談
- 爆破經驗談
- 成人網站YouPorn使用Redis之經驗談網站Redis
- 大學打架經驗談
- Lotus 經驗談(轉)
- FIFO設計驗證經驗談
- Hugo 建站經驗之談Go
- Android MVP經驗談AndroidMVP
- Oracle 學習經驗談Oracle
- Doxygen簡單經驗談。。。
- ERP經驗談(轉)
- SAP學習經驗談
- Linux安全經驗談Linux
- JGraph開發經驗談
- 作為 CEO 使用 Emacs 的兩年經驗之談Mac
- 談談Ilog的開發經驗
- puppeteer踩坑經驗之談
- 淺談SAP學習經驗
- 微軟測試工作經驗談微軟
- 10年出海老兵的經驗談
- kotlin開發經驗談3Kotlin
- kotlin開發經驗談4Kotlin
- kotlin開發經驗談5Kotlin
- Facebook應用Mercurial經驗談
- kotlin開發經驗談2Kotlin
- kotlin開發經驗談1Kotlin
- 技術面試-國外人談經驗面試
- 碼農處事經驗之談
- 資料庫設計經驗談資料庫
- PMP考試經驗談(五)(轉)
- PMP考試經驗談(一)(轉)
- PMP考試經驗談(二)(轉)
- Linux網路安全經驗談Linux