nfs+keepalived高可用
Posted 巽逸
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了nfs+keepalived高可用相关的知识,希望对你有一定的参考价值。
1台nfs主被服务器都下载nfs、keepalived
yum install nfs-utils rpcbind keepalived -y
2台nfs服务器nfs挂载目录及配置必须相同
3.在主nfs服务期编写一个死循环并后台运行
while true
do
if [ `/etc/init.d/nfs status|awk ‘NR==2{print $NF}‘` = "stopped" ]
then
/etc/init.d/keepalived stop
fi
done
4.再挂载服务器写一个守护进程并执行守护进程
挂载服务器脚本内容:
while true
do
if [ `showmount -e 172.16.1.31|wc -l` -eq 0 ]
then
umount /application/nginx-1.10.3/html/blog/wp-content/uploads
umount /application/nginx-1.10.3/html/bbs/data/attachment/image
umount /application/nginx-1.10.3/html/www/uploads/allimg
mount -t nfs 172.16.1.30:/data/blog /application/nginx-1.10.3/html/blog/wp-content/uploads
mount -t nfs 172.16.1.30:/data/bbs /application/nginx-1.10.3/html/bbs/data/attachment/image
mount -t nfs 172.16.1.30:/data/www /application/nginx-1.10.3/html/www/uploads/allimg
exit
fi
done
以上是关于nfs+keepalived高可用的主要内容,如果未能解决你的问题,请参考以下文章
Oracle Compute云快速搭建MySQL Keepalived高可用架构