您好,登錄后才能下訂單哦!
安裝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進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。