设为首页 收藏本站
查看: 588|回复: 0

[经验分享] NFS网络存储文件系统配置流程

[复制链接]
累计签到:1 天
连续签到:1 天
发表于 2016-9-9 09:07:10 | 显示全部楼层 |阅读模式
第1章 NFS服务端配置环境搭建1.1打印系统版本[iyunv@NFS data]# cd ~
[iyunv@NFS ~]# cat /etc/redhat-release           查看系统版本
CentOS release 6.7 (Final)
[iyunv@NFS ~]# uname -r                     
2.6.32-573.el6.x86_64
[iyunv@NFS ~]# uname -m
x86_64
1.2检查并安装NFS服务[iyunv@NFS ~]# rpm -qa nfs-utils rpcbind                    查看系统是否安装此服务
[iyunv@NFS ~]#                                切换为英文
[iyunv@NFS ~]# yum install nfs-utils rpcbind -y                安装服务
Failed to set locale, defaulting to C
Loaded plugins: fastestmirror, security
Setting up Install Process
Loading mirror speeds from cached hostfile
* base:centos.ustc.edu.cn
* extras:centos.ustc.edu.cn
* updates: ftp.twaren.net
[iyunv@NFS ~]# rpm -qa nfs-utils rpcbind                   再次检查是否安装成功
rpcbind-0.2.0-12.el6.x86_64
nfs-utils-1.2.3-70.el6_8.1.x86_64
1.3启动RPC及NFS服务并检查[iyunv@NFS ~]# /etc/init.d/rpcbind restart                   重新启动
Stopping rpcbind: [ OK  ]
Starting rpcbind: [ OK  ]
[iyunv@NFS ~]# ps -ef |grep rpc                           检查服务是否开启
rpcuser  1560     1  0 Sep06 ?        00:00:00 rpc.statd
root     3811     2  0 Sep06 ?        00:00:00 [rpciod/0]
root     3812     2  0 Sep06 ?        00:00:00 [rpciod/1]
rpc      6657     1  0 00:39 ?        00:00:00 rpcbind
root     6777     1  0 00:39 ?        00:00:00 rpc.rquotad
root     6782     1  0 00:39 ?        00:00:00 rpc.mountd
root     6829     1  0 00:39 ?       00:00:00 rpc.idmapd
root     6845  3622  0 00:40 pts/0    00:00:00 grep rpc
[iyunv@NFS ~]# /etc/init.d/rpcbind status                 
rpcbind (pid 6657) is running...
[iyunv@NFS ~]# rpcinfo -p localhost           检查服务的端口是否注册
   programvers 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 38991  mountd
   100005    1   tcp 50462  mountd
   100005    2   udp 42965  mountd
   100005    2   tcp 53821  mountd
   100005    3   udp 36662  mountd
   100005    3   tcp 42793  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  55123  nlockmgr
   100021    3   udp 55123  nlockmgr
   100021    4   udp 55123  nlockmgr
   100021    1   tcp 39753  nlockmgr
   100021    3   tcp 39753  nlockmgr
   100021    4   tcp 39753  nlockmgr
[iyunv@NFS ~]# 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 38991  mountd
100005    1   tcp 50462  mountd
100005    2   udp 42965  mountd
100005    2   tcp 53821  mountd
100005    3   udp 36662  mountd
100005    3   tcp 42793  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 55123  nlockmgr
100021    3   udp 55123  nlockmgr
100021    4   udp 55123  nlockmgr
100021    1   tcp 39753  nlockmgr
100021    3   tcp 39753  nlockmgr
100021    4   tcp 39753  nlockmgr


1.4设置开机自启动并检查[iyunv@NFS ~]# chkconfig nfs on                  开机启动nfs
[iyunv@NFS ~]# chkconfig rpcbind on
[iyunv@NFS ~]# chkconfig --list nfs                查看服务开机启动列表
nfs            0:off   1:off   2:on   3:on    4:on    5:on   6:off
[iyunv@NFS ~]# chkconfig --list rpcbind  
rpcbind        0:off   1:off   2:on   3:on    4:on    5:on   6:off

第2章 NFS服务端功能目录配置2.1配置共享目录[iyunv@NFS ~]# vi /etc/exports                     编辑共享目录和客户端ip段
#shared /data by oldboy for binbing at 20160906
/data 172.16.1.0/24(rw,syn )
"/etc/exports" 3L, 79C written
[iyunv@NFS ~]# cat /etc/exports
#shared /data by oldboy for binbing at 20160906
/data 172.16.1.0/24(rw,sync)
2.2创建共享目录并设置权限[iyunv@NFS ~]# mkdir /data                       创建共享目录
[iyunv@NFS ~]# ls -ld /data
drwxr-xr-x 2 root root 4096 Sep  7 00:54 /data
[iyunv@NFS ~]# chown -R nfsnobody.nfsnobody /data      修改共享目录的属主,和属组
[iyunv@NFS ~]# ls -ld /data
drwxr-xr-x 2 nfsnobody nfsnobody 4096 Sep  7 00:54 /data
[iyunv@NFS ~]# id nfsnobody                          (该用户是系统服务自动创建)查看虚拟用户的详细信息
uid=65534(nfsnobody) gid=65534(nfsnobody)groups=65534(nfsnobody)
[iyunv@NFS ~]# cat /var/lib/nfs/etab                     
/data   172.16.1.0/24(rw,sync,wdelay,hide,nocrossmnt,secure,root_squash,no_all_squash,no_subtree_check,secure_locks,acl,anonuid=65534,anongid=65534,sec=sys,rw,root_squash,no_all_squash)

2.3平滑加载NFS服务并检查服务root@NFS ~]# /etc/init.d/nfs reload    平滑重启服务,运行完已经申请的,不在接受新的申请
[iyunv@NFS ~]# showmount -e localhost  查看挂载情况
Export list for localhost:
/data 172.16.1.0/24
[iyunv@NFS ~]# showmount -e 172.16.1.131        
Export list for 172.16.1.131:
/data 172.16.1.0/24
[iyunv@NFS ~]# mount -t nfs 172.16.1.131:/data /mnt          挂载在自身上,看是否成功。验证服务的有效性
[iyunv@NFS ~]# cd /mnt
[iyunv@NFS mnt]# touch xiaoqiang111                     创建文件,检查是否共享成功
[iyunv@NFS mnt]# cd /data
[iyunv@NFS data]# ll
total 0
-rw-r--r-- 1 nfsnobody nfsnobody 0 Sep  7 01:01 xiaoqiang111

第3章 nfs客户端服务配置流程3.1检查系统版本[iyunv@web01 ~]# cat /etc/redhat-release
CentOS release 6.7 (Final)
[iyunv@web01 ~]# uname -r
2.6.32-573.el6.x86_64
[iyunv@web01 ~]# uname -m
x86_64
3.2安装NFS服务并检查[iyunv@web01 ~]#  rpm -qa nfs-utils rpcbind      
[iyunv@web01 ~]#  LANG=en
[iyunv@web01 ~]#  yum install nfs-utils rpcbind -y
Failed to set locale, defaulting to C
Loaded plugins: fastestmirror, security
Setting up Install Process
Loading mirror speeds from cached hostfile
* base:centos.ustc.edu.cn
* extras:centos.ustc.edu.cn
* updates:ftp.twaren.net
[iyunv@NFS ~]# rpm -qa nfs-utils rpcbind
rpcbind-0.2.0-12.el6.x86_64
nfs-utils-1.2.3-70.el6_8.1.x86_64
3.3启动rpc服务并检查[iyunv@web01 ~]# /etc/init.d/rpcbind start
[iyunv@web01~]# /etc/init.d/rpcbind start
[iyunv@web01 ~]# /etc/init.d/rpcbind status
rpcbind (pid 5049) is running...
3.4设置开机自启动并检查root@web01 ~]# chkconfig rpcbind on
[iyunv@web01 ~]# chkconfig  --list rpcbind
rpcbind        0:off   1:off   2:on   3:on    4:on    5:on   6:off
3.5检查服务端的的NFS是否可以[iyunv@web01 ~]# showmount -e 172.16.1.131     检查挂载是否成功
Export list for 172.16.1.131:
/data 172.16.1.0/24
[iyunv@web01 ~]# mount -t nfs 172.16.1.131:/data  /var     挂载/var目录到NFS服务端
[iyunv@web01 ~]# cd /var         
[iyunv@web01 var]# mkdir xiaoqiang
[iyunv@NFS data]# cd /data
[iyunv@NFS data]# ll
total 4
drwxr-xr-x 2 nfsnobody nfsnobody 4096 Sep  7 01:15 xiaoqiang
-rw-r--r-- 1 nfsnobody nfsnobody    0 Sep 7 01:01 xiaoqiang111


运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-269690-1-1.html 上篇帖子: centos 7 网卡名称更改 下篇帖子: linux做路由并实现路由转发 网络
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表