nfs共享存储

三台服务器

主服务器:192.168.146.129

web1:192.168.146.134

web2:192.168.146.131

1、下载nfs

yum -y install rpcbind nfs-utils
mkdir /opt/~ (创建一个共享目录)
将存储服务器内的文件进行共享:
vim /etc/exports    
/opt/~        192.168.146.0/24(rw,no_root_squash)
重载
exportfs -rv

2、启动服务

service rpcbind start(先启动才能启动nfs)

service nfs start(基于nfs协议)

3、web服务器连接挂载

yum -y install nfs-utils

连接到共享服务器

showmount -e 192.168.146.129

把共享目录挂载到本地目录下

mount -t nfs 192.168.146.134:/opt/~ /opt

4、测试

在本地目录下创建文件查看主服务器是否同步

原文地址:https://www.cnblogs.com/tyk3201/p/12082564.html