NFS文件共享部署

注意说明:

                 NFS文件系统需要root权限启动服务(服务端口号无法设置1024以下)

传输协议端口1端口2
TCP1112049
UDP1114096

 

Centos7 防火墙关闭:

        systemctl stop firewalld.service #停止firewall

        systemctl disable firewalld.service #禁止firewall开机启动

        systemctl list-unit-files|grep firewalld.service   #防火墙处于状态

        需要开启防火墙自行配置配置对应的端口。

NFS服务端部署

安装nfs服务需要的环境包

        yum install nfs-utils rpcbind –y

编辑共享配置文件及ip访问限制

        vim /etc/exports

        /opt/test 192.168.1.101/32(rw,no_root_squash,all_squash,sync)

启动nfs相关服务

        service  rpcbind start

        service nfs start

设置开机启动

        chkconfig rpcbind on

        chkconfig nfs on

配置文件修改,重新加载配置文件生效配置

        exportfs -a

客户端配置

客户端安装环境

        yum install nfs-utils –y

客户端测试

        showmount -e 192.168.1.100

客户端配置挂载

        /bin/mount  -t nfs  192.168.1.100:/opt/test /test_data

客户端挂载脚本

 cat /opt/shell/mount.sh 
#!/bin/bash
list=`df -h |grep test |wc -l`
if [ $list -ne 1  ];then
/bin/mount  -t nfs  192.168.1.100:/opt/test /test_data
fi

添加计划任务:

crontab -e
* * * * * /bin/sh /opt/shell/mount.sh > /dev/null 2>&1

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值