NFS网络文件系统部署
NFS体系:一台NFS 服务器 、若干台客户机
作用:允许网络中的计算机之间共享资源。
应用:本地NFS客户端可以透明地读写位于远端NFS服务器上的文件,就像访问本地文件一样。
NFS服务端部署
- 检查nfs/rpc程序服务有没有安装
[root@server ~]# rpm -qa rpcbind nfs-utils
[root@server ~]#
- 安装nfs与rpc服务软件
[root@server ~]# yum install -y rpcbind nfs--utils
[root@server ~]# rpm -qa rpcbind nfs-utils
rpcbind-0.2.0-48.el7.x86_64
- 编写nfs服务配置文件
[root@server ~]# cat /etc/exports
/data/ 10.1.1.2/24(rw,sync,no_root_squash)
[root@server ~]#
- 创建共享存储目录,授权目录
[root@server ~]# mkdir /data/ -p
[root@server ~]# chmod 777 /data/
- 启动程序服务
[root@server ~]# systemctl start rpcbind
[root@server ~]# systemctl start nfs
- 检查本地是否有可挂载磁盘
[root@server ~]# showmount -e localhost
Export list for localhost:
/data 10.1.1.2/24
客户端部署
- 检查nfs/rpc程序服务有没有安装
[root@client ~]# rpm -qa rpcbine nfs-utils
nfs-utils-1.3.0-0.65.el7.x86_64
[root@client ~]#
2.进行远程共享目录挂载
[root@client ~]# showmount -e 10.1.1.1
Export list for 10.1.1.1:
/data 10.1.1.1/24
3. 进行远程共享目录挂载
[root@client ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos-root 18G 879M 17G 5% /
devtmpfs 479M 0 479M 0% /dev
tmpfs 489M 0 489M 0% /dev/shm
tmpfs 489M 6.7M 483M 2% /run
tmpfs 489M 0 489M 0% /sys/fs/cgroup
/dev/sda1 497M 125M 373M 25% /boot
tmpfs 98M 0 98M 0% /run/user/0
/dev/sr0 4.1G 4.1G 0 100% /opt/centos
10.1.1.1:/data 18G 1.6G 16G 10% /mnt
开启自启动
server端
把下边两行添加到开机自启动/etc/rc.local,(第一次使用rc.local目录,一定要给执行权限,centos7要求)
Systemctl start rpcbind
Systemctl start nfs
client端
把下边一行添加到/etc/rc.local内
Mount -t nfs 10.1.1.1:/data /mnt
关闭防火墙
[root@client ~]# iptables -F
[root@client ~]# iptables -X
[root@client ~]# iptables -Z
[root@client ~]# iptables-save
[root@client ~]# firewall-cmd --state
not running
[root@client ~]# getenforce
Disabled
扩展资料:NFS是基于UDP/IP协议的应用,其实现主要采用远程过程调用RPC机制,
RPC提供了一组与机器、操作系统以及低层传送协议无关的存取远程文件的操作。
采用XDR的支持。XDR是一种与机器无关的数据描述编码的协议,他以独立于任意机器体系结构的格式对网上传送的数据进行编码和解码,支持在异构系统之间数据传送。
资料来源(百度)