Installing Percona-xtrabackup
http://990487026.blog.51cto.com/10133282/1759237
[email protected]:/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& nbsp;/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 "Backup failed! " >> $logfile exit fi echo " No global backup has been detected before, full backup once! " >> $logfile basedir= ' Cat /globalback ' echo "Base this library is $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 "Backup failed! " >> $logfile exit fi ls $backdir | tail -n 1 > /globalback Basedir= ' cat /globalback ' echo ' ↓↓↓↓↓↓↓↓↓↓↓ weekly global backup split line ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ " >> $logfile date " +%f %h:%m " >> $logfile echo Global backup >> $logfile
echo Location of data backup $backdir/$basedir >> $logfile basedir= ' cat /globalback ' echo ' base this library is $backdir/$basedir >> $logfile else basedir= ' cat / Globalback ' last= ' ls $backdir &nBsp; | 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 "Backup failed! " >> $logfile exit fi echo Incremental backup >> $logfile echo "Base This library is $backdir/$basedir >> $logfile echo This backup is $backdir/$incre " >> $logfile echo "MySQL binary log file path" >> $logfile grep "^log.bin" /etc/mysql/my.cnf >> $logfile fi
This article is from the "Soul Bucket" blog, please be sure to keep this source http://990487026.blog.51cto.com/10133282/1771769
Simple and practical MySQL database backup web file backup