本文共 1132 字,大约阅读时间需要 3 分钟。
NFS是一种基于TCP/IP传输的网络文件系统协议,通过NFS服务客户机可以像访问本地目录一样访问远程NFS服务器中提供的共享资源,对于大多数负载均衡群集来说,使用NFS协议来共享数据库较为常见,但NFS服务没有用户认证
机制,且数据在网络上为明文传输,安全性较差,所以,一般只适用于局域网。利用yum仓库安装yum install nfs-utils rpcbind -y//nfs-utils 用于NFS共享发布和访问//rpcbind 用于远端过程调用机制支持默认情况下系统已经安装好这两个服务;chkconfig nfs onchkconfig rpcbind on 可将这两个服务加入开机自启动
mkdir -p /opt/wwwroot //创建共享文件夹vim /etc/exports //编辑NFS服务配置文件; 配置文件中加入/opt/wwwroot 192.168.100.0/24(rw) 或者多用户操作 /opt/wwwroot 192.168.100.11(ro) 192.168.100.22(rw) //(rw)表示加入读写权限;
service rpcbind startservice nfs start关闭防火墙:service iptables stop关闭安全选项:setenforce 0
yum install nfs-utils rpcbind -y 安装服务 service rpcbind start //启动服务 service nfs start //启动服务关闭防火墙:service iptables stop关闭安全选项:setenforce 0 mkdir /share 创建共享文件挂载点
mount.nfs 192.168.100.107:/opt/wwwroot /share //手动挂载或者自动挂载(在/etc/fstab中加入):192.168.100.107:/opt/wwwroot /abc nfs defaults,_netdev 0 0tail -1 /etc/mtab //确认挂载结果
在客户端设置的/share挂载点添加文件,同时服务端也会同步添加。
转载于:https://blog.51cto.com/13659253/2116715