linux Centos (6.5)服务器之间文件共享挂载
目的:因为服务器配置了Keepalive,多服务器的文件上传必然要同步,这里的目的把服务器1设置为主文件服务器
服务器1:192.168.149.133
服务器2:192.168.149.134
两台服务器都需要安装配置的服务
安装NFS
yum install nfs-utils
设置服务自启动
chkconfig rpcbind on
chkconfig nfs on
启动服务
service rpcbind start
service nfs start
主服务器的配置
vi /etc/exports
/usr/njca/jar/syscFile 192.168.149.134(rw,no_root_squash,no_all_squash,sync)
然后重新加载
exportfs -r
从服务器的配置
查看主服务器文件夹是否已共享
showmount -e 192.168.149.134
将从服务器文件夹挂载到主服务器上
******两个服务器上的文件夹要一样的
设置开机挂载,自动加载
mount -t nfs -o rw 192.168.149.133:/usr/njca/jar/syscFile /usr/njca/jar/syscFile
查看是否挂载到主服务器上
df -h
删除共享
umount /usr/njca/jar/syscFile
参考 :https://blog.csdn.net/fenglailea/article/details/42676973