简单实用的mysql数据库备份网页文件备份
安装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
本文题目:简单实用的mysql数据库备份网页文件备份
标题路径:http://scjbc.cn/article/ijpogd.html