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

 

相关文章:

  • 2021-11-18
猜你喜欢
  • 2021-06-22
  • 2022-12-23
  • 2022-12-23
  • 2022-01-20
  • 2019-12-25
  • 2021-12-24
  • 2022-01-15
相关资源
相似解决方案