NFS网络存储文件系统配置流程
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了NFS网络存储文件系统配置流程相关的知识,希望对你有一定的参考价值。
第1章 NFS服务端配置环境搭建
1.1打印系统版本
[[email protected] data]# cd ~
[[email protected] ~]# cat /etc/redhat-release 查看系统版本
CentOS release 6.7 (Final)
[[email protected] ~]# uname -r
2.6.32-573.el6.x86_64
[[email protected] ~]# uname -m
x86_64
1.2检查并安装NFS服务
[[email protected] ~]# rpm -qa nfs-utils rpcbind 查看系统是否安装此服务
[[email protected] ~]# 切换为英文
[[email protected] ~]# 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
[[email protected] ~]# 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服务并检查
[[email protected] ~]# /etc/init.d/rpcbind restart 重新启动
Stopping rpcbind: [ OK ]
Starting rpcbind: [ OK ]
[[email protected] ~]# 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
[[email protected] ~]# /etc/init.d/rpcbind status
rpcbind (pid 6657) is running...
[[email protected] ~]# 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
[[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 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设置开机自启动并检查
[[email protected] ~]# chkconfig nfs on 开机启动nfs
[[email protected] ~]# chkconfig rpcbind on
[[email protected] ~]# chkconfig --list nfs 查看服务开机启动列表
nfs 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[[email protected] ~]# chkconfig --list rpcbind
rpcbind 0:off 1:off 2:on 3:on 4:on 5:on 6:off
第2章 NFS服务端功能目录配置
2.1配置共享目录
[[email protected] ~]# 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
[[email protected] ~]# cat /etc/exports
#shared /data by oldboy for binbing at 20160906
/data 172.16.1.0/24(rw,sync)
2.2创建共享目录并设置权限
[[email protected] ~]# mkdir /data 创建共享目录
[[email protected] ~]# ls -ld /data
drwxr-xr-x 2 root root 4096 Sep 7 00:54 /data
[[email protected] ~]# chown -R nfsnobody.nfsnobody /data 修改共享目录的属主,和属组
[[email protected] ~]# ls -ld /data
drwxr-xr-x 2 nfsnobody nfsnobody 4096 Sep 7 00:54 /data
[[email protected] ~]# id nfsnobody (该用户是系统服务自动创建)查看虚拟用户的详细信息
uid=65534(nfsnobody) gid=65534(nfsnobody)groups=65534(nfsnobody)
[[email protected] ~]# 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服务并检查服务
[email protected] ~]# /etc/init.d/nfs reload 平滑重启服务,运行完已经申请的,不在接受新的申请
[[email protected] ~]# showmount -e localhost 查看挂载情况
Export list for localhost:
/data 172.16.1.0/24
[[email protected] ~]# showmount -e 172.16.1.131
Export list for 172.16.1.131:
/data 172.16.1.0/24
[[email protected] ~]# mount -t nfs 172.16.1.131:/data /mnt 挂载在自身上,看是否成功。验证服务的有效性
[[email protected] ~]# cd /mnt
[[email protected] mnt]# touch xiaoqiang111 创建文件,检查是否共享成功
[[email protected] mnt]# cd /data
[[email protected] data]# ll
total 0
-rw-r--r-- 1 nfsnobody nfsnobody 0 Sep 7 01:01 xiaoqiang111
第3章 nfs客户端服务配置流程
3.1检查系统版本
[[email protected] ~]# cat /etc/redhat-release
CentOS release 6.7 (Final)
[[email protected] ~]# uname -r
2.6.32-573.el6.x86_64
[[email protected] ~]# uname -m
x86_64
3.2安装NFS服务并检查
[[email protected] ~]# rpm -qa nfs-utils rpcbind
[[email protected] ~]# LANG=en
[[email protected] ~]# 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
[[email protected] ~]# 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服务并检查
[[email protected] ~]# /etc/init.d/rpcbind start
[[email protected]~]# /etc/init.d/rpcbind start
[[email protected] ~]# /etc/init.d/rpcbind status
rpcbind (pid 5049) is running...
3.4设置开机自启动并检查
[email protected] ~]# chkconfig rpcbind on
[[email protected] ~]# chkconfig --list rpcbind
rpcbind 0:off 1:off 2:on 3:on 4:on 5:on 6:off
3.5检查服务端的的NFS是否可以
[[email protected] ~]# showmount -e 172.16.1.131 检查挂载是否成功
Export list for 172.16.1.131:
/data 172.16.1.0/24
[[email protected] ~]# mount -t nfs 172.16.1.131:/data /var 挂载/var目录到NFS服务端
[[email protected] ~]# cd /var
[[email protected] var]# mkdir xiaoqiang
[[email protected] data]# cd /data
[[email protected] 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
本文出自 “11566241” 博客,请务必保留此出处http://crazyfrog.blog.51cto.com/11566241/1847462
以上是关于NFS网络存储文件系统配置流程的主要内容,如果未能解决你的问题,请参考以下文章
01: 存储技术与应用 iSCSI技术应用 udev配置 NFS网络文件系统 Mul