NFS学习小结

系统环境:

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

CentOS release 6.7 (Final)

[[email protected] ~]#

[[email protected] ~]# uname -r

2.6.32-573.el6.x86_64

[[email protected] ~]# uname -m

x86_64

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

[[email protected] ~]# yum install nfs-utils rpcbind -y

...........

已安装:

nfs-utils.x86_64 1:1.2.3-64.el6              rpcbind.x86_64 0:0.2.0-11.el6

作为依赖被安装:

keyutils.x86_64 0:1.4-5.el6                libevent.x86_64 0:1.4.13-4.el6

libgssglue.x86_64 0:0.1-11.el6             libtirpc.x86_64 0:0.2.1-10.el6

nfs-utils-lib.x86_64 0:1.1.5-11.el6        python-argparse.noarch 0:1.2.1-2.1.el6

完毕!

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

nfs-utils-1.2.3-64.el6.x86_64

rpcbind-0.2.0-11.el6.x86_64

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

rpcbind 已停

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

正在启动 rpcbind:                                         [确定]

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

rpcbind (pid  27104) 正在运行...

[[email protected] ~]# lsof -i :111

COMMAND   PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME

rpcbind 27104  rpc    6u  IPv4  31439      0t0  UDP *:sunrpc

rpcbind 27104  rpc    8u  IPv4  31442      0t0  TCP *:sunrpc (LISTEN)

rpcbind 27104  rpc    9u  IPv6  31444      0t0  UDP *:sunrpc

rpcbind 27104  rpc   11u  IPv6  31447      0t0  TCP *:sunrpc (LISTEN)

[[email protected] ~]# netstat -lntup|grep rpcbind

tcp        0      0 0.0.0.0:111                 0.0.0.0:*                   LISTEN      27104/rpcbind

tcp        0      0 :::111                      :::*                        LISTEN      27104/rpcbind

udp        0      0 0.0.0.0:991                 0.0.0.0:*                               27104/rpcbind

udp        0      0 0.0.0.0:111                 0.0.0.0:*                               27104/rpcbind

udp        0      0 :::991                      :::*                                    27104/rpcbind

udp        0      0 :::111                      :::*                                    27104/rpcbind

[[email protected] ~]# chkconfig --list rpcbind

rpcbind         0:关闭  1:关闭  2:启用  3:启用  4:启用  5:启用  6:关闭

[[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

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

rpc.svcgssd 已停

rpc.mountd 已停

nfsd 已停

rpc.rquotad 已停

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

启动 NFS 服务:                                            [确定]

关掉 NFS 配额:                                            [确定]

启动 NFS mountd:                                          [确定]

启动 NFS 守护进程:                                        [确定]

正在启动 RPC idmapd:                                      [确定]

[[email protected] ~]# netstat -lntup|grep 2049             ------nfs主端口

tcp        0      0 0.0.0.0:2049                0.0.0.0:*                   LISTEN      -

tcp        0      0 :::2049                     :::*                        LISTEN      -

udp        0      0 0.0.0.0:2049                0.0.0.0:*                               -

udp        0      0 :::2049                     :::*                                    -

[[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  40562  mountd

100005    1   tcp  43893  mountd

100005    2   udp  53127  mountd

100005    2   tcp  36081  mountd

100005    3   udp  56672  mountd

100005    3   tcp  52133  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  42438  nlockmgr

100021    3   udp  42438  nlockmgr

100021    4   udp  42438  nlockmgr

100021    1   tcp  36179  nlockmgr

100021    3   tcp  36179  nlockmgr

100021    4   tcp  36179  nlockmgr

加入开机自启动:

[[email protected] ~]# cat /etc/rc.local

......

/etc/init.d/rpcbind start

/etc/init.d/nfs start

[[email protected] ~]# ps -ef|egrep "nfs|rpc"

rpc      27104     1  0 10:35 ?        00:00:00 rpcbind

root     27208     2  0 10:44 ?        00:00:00 [rpciod/0]

root     27209     2  0 10:44 ?        00:00:00 [rpciod/1]

root     27218     1  0 10:44 ?        00:00:00 rpc.rquotad     磁盘配额进城

root     27223     1  0 10:44 ?        00:00:00 rpc.mountd      权限管理验证

root     27230     2  0 10:44 ?        00:00:00 [nfsd4]

root     27231     2  0 10:44 ?        00:00:00 [nfsd4_callbacks]

root     27232     2  0 10:44 ?        00:00:00 [nfsd]      =====>nfs主进程

root     27233     2  0 10:44 ?        00:00:00 [nfsd]      =====>nfs主进程

root     27234     2  0 10:44 ?        00:00:00 [nfsd]      =====>nfs主进程

root     27235     2  0 10:44 ?        00:00:00 [nfsd]

root     27236     2  0 10:44 ?        00:00:00 [nfsd]

root     27237     2  0 10:44 ?        00:00:00 [nfsd]

root     27238     2  0 10:44 ?        00:00:00 [nfsd]

root     27239     2  0 10:44 ?        00:00:00 [nfsd]

root     27270     1  0 10:44 ?        00:00:00 rpc.idmapd

root     27299  2056  0 10:54 pts/1    00:00:00 grep -E nfs|rpc

[[email protected] ~]# mkdir /data

[[email protected] ~]# cat /etc/exports

/data  10.0.0.*(rw,sync)

[[email protected] ~]# /etc/init.d/nfs reload        重新加载服务

[[email protected] ~]# showmount -e 127.0.0.1         ======>查看共享的记录

Export list for 127.0.0.1:

/data 10.0.0.*

[[email protected] ~]# mount -t nfs 10.0.0.7:/data /mnt      将/data目录挂载到/mnt下面

[[email protected] ~]# df -h

Filesystem      Size  Used Avail Use% Mounted on

/dev/sda3        19G  1.5G   16G   9% /

tmpfs           937M     0  937M   0% /dev/shm

/dev/sda1       190M   36M  145M  20% /boot

10.0.0.7:/data   19G  1.5G   16G   9% /mnt                ======>已挂载成功

[[email protected] mnt]# touch /data/oldboy.txt

[[email protected] mnt]# ll /data/

总用量 0

-rw-r--r-- 1 root root 0 11月 23 11:16 oldboy.txt

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

正在启动 rpcbind:                                         [确定]

[[email protected] ~]# chkconfig rpcbind on

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

Export list for 10.0.0.7:

/data 10.0.0.0/24

客户端挂载:

[[email protected] ~]# mount -t nfs 10.0.0.7:/data /mnt

[[email protected] ~]# df -h

Filesystem      Size  Used Avail Use% Mounted on

/dev/sda3        19G  1.5G   16G   9% /

tmpfs           937M     0  937M   0% /dev/shm

/dev/sda1       190M   36M  145M  20% /boot

10.0.0.7:/data   19G  1.5G   16G   9% /mnt

[[email protected] data]# touch oldboy.txt       =======>服务端创建一个文件oldboy.txt

[[email protected] data]# ll

总用量 0

-rw-r--r-- 1 root root 0 11月 23 11:25 oldboy.txt

[[email protected] mnt]# ll

总用量 0

-rw-r--r-- 1 root root 0 11月 23 11:25 oldboy.txt         ======>客户端查看是存在的

[[email protected] mnt]# touch abc.txt                    ======>在客户端没有写的权限

touch: 无法创建"abc.txt": 权限不够

出现此问题在于权限不对,服务器端需要对此目录进行授权,权限为nfsnobody

[[email protected] data]# chown -R nfsnobody /data/          ======>授权服务端对/data具有写权限

[[email protected] data]# ll /data/

总用量 0

-rw-r--r-- 1 nfsnobody root 0 11月 23 11:25 oldboy.txt     ======>属主权限已改

然后再在客户端创建

[[email protected] mnt]# touch abc.txt                     =======>客户端已能够成功创建文件

[[email protected] mnt]#

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

正在启动 rpcbind:                                         [确定]

[[email protected] ~]# chkconfig rpcbind on

[[email protected] ~]# mount -t nfs 10.0.0.7:/data /mnt    =======>挂载

[[email protected] ~]# df -h

Filesystem      Size  Used Avail Use% Mounted on

/dev/sda3        19G  1.5G   16G   9% /

tmpfs           937M     0  937M   0% /dev/shm

/dev/sda1       190M   36M  145M  20% /boot

10.0.0.7:/data   19G  1.5G   16G   9% /mnt               =======>已挂载成功

[[email protected] mnt]# touch 9.txt

[[email protected] mnt]# ll

-rw-r--r-- 1 nfsnobody nfsnobody 0 11月 23 11:41 9.txt

[[email protected] data]# rm -f 9.txt

已删除。

结论:无论在哪个nfs目录下创建文件,其他客户端都能够进行删除,解决了共享存储问题。

检查思路:

1  ping

2  telnet

3  出现no route to host,则必须要检查防火墙和安全策略

4  showmount

时间: 2024-08-03 18:32:12

NFS学习小结的相关文章

git学习小结

背景:最近因为工作原因,需要将以前的代码库由bitbucket重新布置在一台服务器上,所以就学习了下git,特此记录下 在167这台机器上搭建apache,用做git server,由于以前apache都已经搭好了,所以这里只配置git server 就可以了,此处贴出配置: 服务器搭好了,来到配置中的root目录,git clone https://[email protected]/XXXX 此时,库和服务器都搭好了,用于新库测试的机器也可以从git server上克隆库了,来,我们来试试从

网络编程学习小结

几种网络编程方式: ISAPI.CGI.WinInet.Winsock 它们之间的差别: 1)  ISAPI主要是开发基于浏览器client与server端程序.效率比CGI方式高,并且也扩展了CGI没有的一些功能.(基于TCP/IP模型中的应用层) 2)  CGI主要是开发基于浏览器client与server端程序.(基于TCP/IP模型中的应用层) 3)  WinInet主要是开发client程序.(基于TCP/IP模型中的应用层) 4)  Winsock主要是基于socket来开发clie

MogileFS学习小结

大纲: 一.关于MogileFS 二.常见分布式文件系统 三.MogileFS基本原理 四.MogileFS的实现 一.关于MogileFS 当下我们处在一个互联网飞速发展的信息社会,在海量并发连接的驱动下每天所产生的数据量必然以几何方式增长,随着信息连接方式日益多样化,数据存储的结构也随着发生了变化.在这样的压力下使得人们不得不重新审视大量数据的存储所带来的挑战,例如:数据采集.数据存储.数据搜索.数据共享.数据传输.数据分析.数据可视化等一系列问题. 传统存储在面对海量数据存储表现出的力不从

201671010130 2016-2017-2 《Java程序设计》第四周学习小结

第四周学习小结 本次实验巩固了上次实验分隔数并求和的题,目前这个题有两种做法,一种是不断对数10求余,余数保存在sum中,然后左移一位,直到余数为零.另一种就是将数字强制转换成一个字符串数组String s=String.valueOf(num),根据方法s.toCharArray()将字符分离出来,据"x"-"0"=x,unicode码值相减即可得x的值. 父类和子类能够看两个交集,super关键字是否能够看做一个子类和超类的接口呢? 在子类中可以增加域.增加方法

初识ASP.NET---点滴的积累---ASP.NET学习小结

差不多十多天前学习完了北大青鸟的学习视频,没想到没几天的时间就看完了XML视频和牛腩的Javascript视频.学习完了也该总结总结,理理自己的思路,消化一下自己学习到的东西. 视频中的理论知识并不是很多,以例子驱动学起来也不会他过于乏味.全部的学习内容大概的可以用下图表示. 个人感觉这套视频的体系感不是很强,每一集之间老师的串联并不是做得很好,向我等没有教材的有些小的知识无从知晓.但是不能不说这套视频确很适合初学者学习,老师讲解的也不错,从此我也算是入门. 当然要想进一步的了解ASP.NET并

8086汇编学习小结———实时更新

初学IBM-PC 8086,对INT指令不是很理解.现从网上总计如下: 表:DOS系统功能调INT 21H AH 功能 调用参数 返回参数 00 程序终止(同INT 20H) CS=程序段前缀 01 键盘输入并回显 AL=输入字符 02 显示输出 DL=输出字符 03 异步通迅输入 AL=输入数据 04 异步通迅输出 DL=输出数据 05 打印机输出 DL=输出字符 06 直接控制台I/O DL=FF(输入)DL=字符(输出) AL=输入字符 07 键盘输入(无回显) AL=输入字符 08 键盘

《Pro AngularJS》学习小结-01

<Pro AngularJS>该书以一个SportsStore案例为主线铺开. 一.开发环境设置 该书中所用的server开发环境是Deployed,从来没听说过,而且作者也说该server没什么人用,我干脆弃用之.其他的环境包括 NodeJS--这个必须装 karma--测试环境,前期还没有用到,以后认真研究,毕竟AngularJS一大特点是Unit Test bootstrap--这个现在应该普遍使用了,O(∩_∩)O webstorm--现在唯一支持AngularJS插件的IDE 我基本

自动化测试Selenium Webdriver (JAVA)学习小结

自动化测试--Selenium学习小结 一.自动化测试的概念及意义: 1.什么是自动化测试: 一般是指软件测试的自动化,软件测试就是在预设条件下运行系统或应用程序,评估运行结果,预先条件应包括正常条件和异常条件. 2.意义: 让测试更有效率,利用更多的空余时间,减少人力资源. 二.selenium工具 我用的是java语言,所以接下来的例子和方法都是基于java的. 1.环境配置 (1)Jdk的配置: 我用的是1.7的jdk,配置方法都一样,新建一个JAVA_HOME,把你装好的jdk的路径复制

点滴的积累---J2SE学习小结

点滴的积累---J2SE学习小结 什么是J2SE J2SE就是Java2的标准版,主要用于桌面应用软件的编程:包括那些构成Java语言核心的类.比方:数据库连接.接口定义.输入/输出.网络编程. 学习感受 近半个月的坎坷,总算是将马士兵的<J2SE教程>视频看完了,期间一些其它的事一些不得不处理的事总是打断我的安排.看了视频之后认为东西确实都非常基础给我印象最深的是关于程序执行的内存分析.IO和线程,这谁在之前不管是学习VB.VB.NET还是C#中都没怎么设计到的东西. 首先,我想对于一个初学