nfs

NFS 服务 : Network File system 网络文件系统
效果: 好像在本机硬盘一样
原理: 当用户去访问 映射成本地系统 // 原理 挂载
属性: vsftpd 是应用程序,(内核支持) nfs 是一个文件系统
应用: 局域网(最多用于) — 依赖网络

应用层 app httpd 80 vsftpd

传输层 tcp/ip
internet层 network
数据链路层

#locate ext4.ko — locate 查找文件或目录
locate nfs.ko —> nfs 是内核级别

client
|
|
VFS // 系统文件的翻译层相当于java的jvm
|
|
RPC/XDR
| |
| |
TCP/IP tcp/ip
| |
| |
Ethernet Ethernet
| |
|——————————————network———————|
NFS 服务介绍
软件包: nfs-utils
kernel 支持nfs.ko
端口:2049(nfsd) 其他端口由portmap(111) 分配
配置文件 /etc/exports /etc/exports.d/*.exports
相关软件包 rpcbind , tcp_wrappers
yum install rpcbind yum install nfs-utils
—————————————-
案例1:

#rpm -qi nfs-utils
rpm -ql nfs-utils

systemctl start nfs-server // centos7 –> centos6 nfs
ss -ntl —> 端口 2049 其他端口会变 –>
rpcinfo -p 查看 所有的端口(端口会变)

centos6————————————————
service nfs start —> 会产生随机端口
service rpcbind status –> 端口111 来管理随机端口
原理 :客户端先连接 rpcbind(客户端:请你告诉我nfs端口,rpcbind 会告诉端口) 在连接访问nfs

案例1(1): centos6
service rpcbind stop — 当rpcbind 停止了
service nfs restart — 启动就不行了
service rpcbind restart — 启动了
service nfs restart — nfs 启动了 –>总结: nfs 依赖 rpcbind 服务

案例1(2) :centos7
systemctl stop rpcbind — 停止 –> systemctl status rpcbind // 查看状态
systemctl restart nfs-server — 启动nfs-server
systemctl status rpcbind — 查看rpcbind 也启动了
总结: 当rpcbind 停止 , 启动nfs-server ,rpcbind 也跟着启动 –> 有依赖性 自动激活
—————————————-
案例1(3): centos7
systemctl status rpcbind.socket // 特性 rpcbind 和 rpcbind.socket
systemctl stop rpcbind.socket // 停止
systemctl status rpcbind // 查看rpcbind 也停止了
注意 : rpcbind 就是 rpcbind.server
systemctl start rpcbind // 启动 rpcbind
systemctl status rpcbind.socket // 也启动了

当 systemctl stop rpcbind –> systemctl status rpcbind.socket 还在运行
原理: rpcbind.socket 还在监听 ,当用户访问 会把 rpcbind.server 激活
———————————————–
总结:当 nfs.server 启动 <—- rpcbind 启动 <—– rpcbind.socket 启动 ——————- 案例1(4) centos7 showmount -e 192.168.100.6 // 查看远程主机的共享 Export list for 192.168.100.6: –> 说明有共享服务 ,没有共享 文件夹
—————
案例1(5) centos6
service rpcbind start — 启动了 service nfs start –启动 // 依赖rpcbind 服务启动
现在 service rpcbind stop 会怎么样 ? 用户访问 ?
service nfs status — 查看running
#showmount -e 192.168.100.6 //centos7 上查看远程主机的共享
clnt_create: RPC: Port mapper failure – Unable to receive: errno 111 (Connection refused) // 不可以
总结:表面上连接 的是 nfs 实际上 先连接 rpcbind (中间断层了)
1. service start rpcbind 2. service restart nfs –> showmount -e 192.168.100.6
—————————————–
案例1(6)
ps aux |grep rpc
nfs 服务主要进程 :
rpc.nfsd 最主要的NFS 进程 , 管理客户端是否可登陆
rpc.mountd 挂载和卸载NFS 文件系统 , 包括权限管理
rpc.lockd 非必要 管理文件锁 避免同时写出错
rpc.statd 非必要 检查文件一致性 可修复文件 日志: /var/lib/nfs
—————————————————
案例1(7) NFS 配置文件 *
rpm -ql nfs-utils
rpm -qf /etc/exports –> 创建共享,也可以放在 /etc/exports.d/ 的子目录下面

/etc]#ls |grep exports
exports
exports.d

本文来自投稿,不代表Linux运维部落立场,如若转载,请注明出处:http://www.178linux.com/91451

(1)
百涧溪百涧溪
上一篇 2018-02-05 08:43
下一篇 2018-02-05 10:52

相关推荐

  • 跟着vimtutor走来认识vim

        一、前言        VIM是一款在vi上进行改进的功能性强大的,开源的文本编辑器。     二、vim的设计理念     vim的设计理念是组合;       命令组合:类似于linux的由一个个单一功能的程…

    Linux干货 2016-05-13
  • GRUB

    什么是GRUB GRUB(boot loader):grub:GRand Unified Bootloader     有两个版本:grub 0.x:grub legacy经典版;grub 2.x grub legacy:主要运行分三个阶段 stage1(第一阶段):安装在mbr中 stage1.5(第1.5阶段):存…

    Linux干货 2016-09-21
  • find可以这么用

    在工作中不可或缺的工具find:查找系统中的各种文件,对查找的文件进行操作,这就是find的作用。进入正题: 1、查找下系统中有一下系统中有几个文件叫issue的     [root@localhost private]#find / -name issue      …

    Linux干货 2017-03-05
  • Sed及Vim作业

      Sed及Vim作业题:     1、删除/etc/grub2.conf文件中所有以空白开头的行行首的空白字符    [root@localhost 7 ~]# sed -r  's/^[[:space:]]…

    Linux干货 2016-08-09
  • 在Centos7上源码编译httpd

    在Centos7上源码编译httpd 安装源码包 首先在http://httpd.apache.org下载所需要的安装包 小编在这里下载的是httpd-2.4.27.tar apr-1.6.2.tar apr-util-1.6.0.tar 首先编译安装apr-1.6.2.tar.gz #1 tar -zxf apr-1.6.2.tar.gz #先解压安装包 …

    2017-08-21
  • Linux系统的介绍及如何获取帮助?(学习笔记)

    第一、Linux 基础   CPU架构:      x86      x64 (amd64)      m68000,m68k      arm    &nbs…

    Linux干货 2016-12-12