nfs主從搭建詳細教程

來源:互聯網
上載者:User

標籤:nfs服務端


++++++++++++++++++++++++++++++++NFS服務端+++++++++++++++++++++++++++++++++

1)列印系統版本


cat /etc/redhat-release

[[email protected] ~]# cat /etc/redhat-release 

CentOS release 6.6 (Final)


uname -r

[[email protected] ~]# uname -r

2.6.32-504.el6.x86_64


uname -m

[[email protected] ~]# uname -m

x86_64


2)檢查並安裝NFS服務

rpm -aq nfs-utils portmap rpcbind


LANG=EN


yum grouplist



yum install nfs-utils rpcbind -y



rpm -aq nfs-utils portmap rpcbind(必須安裝以下兩個包)

[[email protected] ~]# rpm -qa nfs-utils portmap rpcbind

nfs-utils-1.2.3-64.el6.x86_64

rpcbind-0.2.0-11.el6.x86_64


3)啟動RPC及NFS服務並檢查


/etc/init.d/rpcbind start

[[email protected] ~]# /etc/init.d/rpcbind start

Starting rpcbind:                                  [  OK  ]



ps -ef|grep rpc

[[email protected] ~]# ps -ef |grep rpc

rpc       1601     1  0 11:43 ?        00:00:00 rpcbind

root      1605  1386  0 11:44 pts/0      00:00:00 grep rpc


/etc/init.d/rpcbind status

[[email protected] ~]# /etc/init.d/rpcbind status

rpcbind (pid  1601) is running...


rpcinfo -p localhost

[[email protected] ~]# 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


/etc/init.d/nfs start

[[email protected] ~]# /etc/init.d/nfs start

Starting NFS services:                              [  OK  ]

Starting NFS quotas:                               [  OK  ]

Starting NFS mountd:                               [  OK  ]

Starting NFS daemon:                               [  OK  ]

Starting RPC idmapd:                               [  OK  ]


rpcinfo -p localhost

[[email protected] ~]# 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  35343  mountd

    100005    1   tcp  52042  mountd

    100005    2   udp  53616  mountd

    100005    2   tcp  37579  mountd

    100005    3   udp  57976  mountd

    100005    3   tcp  53085  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  41285  nlockmgr

    100021    3   udp  41285  nlockmgr

    100021    4   udp  41285  nlockmgr

    100021    1   tcp  49062  nlockmgr

    100021    3   tcp  49062  nlockmgr

    100021    4   tcp  49062  nlockmgr

4)設定開機自啟動並檢查


chkconfig nfs on


chkconfig rpcbind on


chkconfig --list nfs


chkconfig --list rpcbind


5)配置共用/data目錄


cat >>/etc/exports<<EOF

#shared data for bbs by oldboy at 20140901

/data 192.168.59.131/24(rw,sync)

EOF

cat /etc/exports 


6)建立共用目錄

mkdir /data

ll /data/

chown -R nfsnobody.nfsnobody /data


7)平滑載入NFS服務並檢查服務


/etc/init.d/nfs reload


showmount -e localhost

[[email protected] ~]# showmount -e localhost

Export list for localhost:

/data 192.168.59.131/24




++++++++++++++++++++++++++++++++++++NFS用戶端+++++++++++++++++++++++++++++++++++++

1)檢查系統版本


hostname nfsclient 更改主機名稱


cat /etc/redhat-release


uname -r


uname -m


2)安裝rpc服務並檢查


rpm -aq nfs-utils portmap rpcbind


yum groupinstall "NFS file server" -y


rpm -aq nfs-utils portmap rpcbind


3)啟動rpc服務並檢查


/etc/init.d/rpcbind start


/etc/init.d/rpcbind status


4)設定開機自啟動並檢查


chkconfig rpcbind on


chkconfig --list rpcbind


5)檢查服務端的NFS是否OK


showmount -e 192.168.59.131

[[email protected] ~]# showmount -e 192.168.59.131

Export list for 192.168.59.131:

/data 192.168.59.131/24



排查故障:

ping 192.168.59.131

telnet 192.168.59.131 111

注意防火牆


6)掛載並測試


mount -t nfs 192.168.59.131:/data /mnt



cd /mnt


ls -l


touch 123.log


ls -l


echo "mount -t nfs 192.168.59.131:/data /mnt" >>/etc/rc.local


本文出自 “蠻荒之力” 部落格,請務必保留此出處http://chenfei123.blog.51cto.com/1427669/1701170

nfs主從搭建詳細教程

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.