Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Simple and practical mysql database backup web page file backup

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Install percona-xtrabackup

Http://990487026.blog.51cto.com/10133282/1759237

Root@uat:/backup# cat xtrabackup.sh #! / bin/bashbackdir=/backup/mysqlweb_page_backdir=/backup/user=r**tpass=a*tlogfile=innobackupex.log# backup web page file mytime= `date + "% F_%H-%M-%S" `cd / var/www/tar-zcf ${mytime} _ html.tar.gz html/mv ${mytime} _ html.tar.gz $web_page_backdirweek= `date +% u`mkdir $backdir > > / dev/null 2 > & 1if [! -f / globalback] then cat / dev/null > $logfile innobackupex-- user=$user-- password=$pass $backdir stat= `echo $? `ls $backdir | tail-N1 > / globalback basedir= `cat / globalback`last= `ls $backdir | tail-n 1`cat "+% F% HRV% M" > > $logfile if [$stat-ne 0] then echo "backup failed!" > > $logfile exit fi echo "detected that no global backup has been done before, a full backup!" > > $logfile basedir= `cat / globalback`echo "Base library is $backdir/$basedir" > > $logfileexitfiif [$week-eq 7] then innobackupex-- user=$user-- password=$pass $backdir stat= `echo $? `incre= `ls $backdir | tail-n 1`cat [$stat-ne 0] then date "+% F% hav% M" > > $logfile echo backup failed! " > $logfile exit fi ls $backdir | tail-N1 > / globalback basedir= `cat / globalback`echo "↓ Weekly Global backup split Line ↓" > $logfile date "+% F% backdir% M" > $logfile echo "Global backup" > > $logfile echo "location of data backup $backdir/$basedir" > > $logfile basedir= `cat / globalback` echo "the base library is $backdir/$basedir" > > $logfileelse basedir= `cat / globalback`last= `ls $backdir | tail-n 1`cat-- user=$user-- password=$pass-- incremental $backdir-- incremental-basedir=$backdir/$last stat= `echo $? `incre= `ls $backdir | tail-n 1`cat "> $logfile date" +% F% stat% M "> > $logfile if [$stat-ne 0] then echo" backup failed! " > > $logfile exit fi echo "incremental backup" > > $logfile echo "Base 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 > > $logfilefi

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report