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

上一篇:[c/c++] programming之路(9)、运算优先级


下一篇:手势识别官方教程(7)识别缩放手势用ScaleGestureDetector和SimpleOnScaleGestureListener