nfs服务器共享存储

NFS的使用:

主机   192.168.189.129

备份机 192.168.189.130

图文详解见:https://www.cnblogs.com/security-guard/Linux公社详解NFS共享存储服务

 实验操作:准备一台服务器当存储服务器,在其上部署nfs(192.168.189.129)

1)机器下载  rpcbind 和 nfs-utils

yum -y install rpcbind nfs-utils

  开启服务,并在主服务器设置开机自启

linux 6:

service rpcbind start
service nfs start
chkconfig rpcbind on
chkconfig nfs on

linux 7:
systemctl start rpcbind
systemctl enable rpcbind
systemctl start  nfs
systemctl enable nfs

2)准备一个共享目录

mkdir /opt/html

3)编辑共享文件

编辑共享文件
vim /etc/exports

/opt/html       192.168.189.0/24(rw,no_root_squash)  #赋予读写权限

重载共享配置文件
   exportfs -rv
关闭相关防火墙,selinux
linux 6:
   service iptables stop
   setenforce 0
linux 7:
   systemctl stop firewalld
   setenforce 0

  

4) 在客户端挂载该共享目录(192.168.189.130)

首先下载nfs

yum -y install nfs-utils

  下一步:

挂载129机器
showmout -e 192.168.189.129
如果可以看到共享的目录,说明可以执行挂载该目录了
mount  -t  nfs   192.168.189.129:/opt/html   /var/www/html

执行mount命令查看是否挂载成功
mount
成功:192.168.189.129:/opt/html on /var/www/html type nfs (rw,vers=4,addr=192.168.189.129,clientaddr=192.168.189.130)

  

附件:

NFS常用路径

说明

/etc/exports

NFS服务的主配置文件。

/usr/sbin/exports

NFS的管理命令,可以加载NFS配置生效等

/usr/sbin/showmount

用来客户端查看NFS配置及挂在结果命令

/var/lib/nfs/etab

NFS配置文件的完整参数设定文件

/pro/mounts

客户端挂在参数

/vae/lib/nfs/rmtab

客户端访问服务器exports的信息列表

猜你喜欢

转载自www.cnblogs.com/security-guard/p/12076046.html