在MFS发生主备切换,或者master-salve切换的时候的执行数据同步的脚本
10.88.0.111为VIP #keeplived+lvs来实现的
10.88.0.28 #MFS双主节点之一
10.88.0.29 #MFS双主节点之一
$ cat MFS_DATA_Sync.sh
#!/bin/bash
A=`ip addr|grep 10.88.0.111|awk -F" " '{print $2}'|cut -d"/" -f1`
if [ $A == 10.88.0.111 ];then
/etc/init.d/mfsmaster stop
/bin/rm -f /soft/mfs/var/mfs/*
/usr/bin/rsync -e "ssh -p22" -avpgolr 10.88.0.29:/soft/mfs/var/mfs/* /soft/mfs/var/mfs/
/soft/mfs/sbin/mfsmetarestore -m
/etc/init.d/mfsmaster -a
sleep 3
echo "this server has become the master of MFS"
if [ $A != 10.88.0.111 ];then
echo "this server is still MFS's slave"
fi
fi