您好,登录后才能下订单哦!
密码登录
登录注册
点击 登录注册 即表示同意《亿速云用户服务条款》
安装percona-xtrabackup
http://990487026.blog.51cto.com/10133282/1759237
root@uat:/backup# cat xtrabackup.sh #!/bin/bash backdir=/backup/mysql web_page_backdir=/backup/ user=r**t pass=a**********t logfile=innobackupex.log #备份网页文件 mytime=`date +"%F_%H-%M-%S"` cd /var/www/ tar -zcf ${mytime}_html.tar.gz html/ mv ${mytime}_html.tar.gz $web_page_backdir week=`date +%u` mkdir $backdir >> /dev/null 2>&1 if [ ! -f /globalback ] then cat /dev/null > $logfile innobackupex --user=$user --password=$pass $backdir stat=`echo $?` ls $backdir | tail -n 1 > /globalback basedir=`cat /globalback` last=`ls $backdir | tail -n 1` date "+%F %H:%M" >> $logfile if [ $stat -ne 0 ] then echo "备份失败!" >> $logfile exit fi echo " 检测到之前没有做过全局备份,完全备份一次!" >> $logfile basedir=`cat /globalback` echo "基 本库是 $backdir/$basedir " >> $logfile exit fi if [ $week -eq 7 ] then innobackupex --user=$user --password=$pass $backdir stat=`echo $?` incre=`ls $backdir | tail -n 1` if [ $stat -ne 0 ] then date "+%F %H:%M" >> $logfile echo "备份失败!" >> $logfile exit fi ls $backdir | tail -n 1 > /globalback basedir=`cat /globalback` echo "↓↓↓↓↓↓↓↓↓↓↓ 每周全局备份分割线 ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓" >> $logfile date "+%F %H:%M" >> $logfile echo "全局备份" >> $logfile echo "数据备份的位置 $backdir/$basedir " >> $logfile basedir=`cat /globalback` echo "基 本库是 $backdir/$basedir " >> $logfile else basedir=`cat /globalback` last=`ls $backdir | tail -n 1` innobackupex --user=$user --password=$pass --incremental $backdir --incremental-basedir=$backdir/$last stat=`echo $?` incre=`ls $backdir | tail -n 1` echo "" >> $logfile date "+%F %H:%M" >> $logfile if [ $stat -ne 0 ] then echo "备份失败!" >> $logfile exit fi echo "增量备份 " >> $logfile echo "基 本库是 $backdir/$basedir " >> $logfile echo "本次备份是 $backdir/$incre " >> $logfile echo "MySQL二进制日志文件路径" >> $logfile grep "^log.bin" /etc/mysql/my.cnf >> $logfile fi
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。