基于Innobackupex的MySQL备份脚本(3)

# Send mail for backup result.
echo "" >>${logFile}
echo "Below is detail log for current innobackup.">>${logFile}
cat ${logDir}/bak_${ts}.log >>${logFile}
mailadd='jack@12306.cn,ww@12306.cn'

if [ -e "${logFile}" ]; then
  status=`grep -i "innobackupex: completed OK!" ${logFile}`
  if [ -n "${status}" ]; then
      cat ${logFile} |mutt -s "Successful backup for MySQL hotbackup on `hostname`." $mailadd
  else
      cat ${logFile} |mutt -s "Failed backup for MySQl hotbackup on `hostname`." $mailadd
  fi
else
  echo "The hotbackup logfile was not found on `hostname`." | \ 
  mutt -s "Failed backup for MySQl hotbackup on `hostname`." $mailadd
fi
 
exit

3、调用示例

SHELL> more call_innobk.sh
#!/bin/bash
/db_scripts/innobk.sh --backup-dir=/data/backup --host=127.0.0.1 --port=3306 --user=innobk --password=InnoBK

SHELL> crontab -l
0 3 * * * /db_scripts/call_innobk.sh

SHELL> cd /data/backup
SHELL> ls
checkpoint  log  physical
SHELL> cd physical/
SHELL> ls
20141228  20141231  20150104  20150107 
SHELL> cd 20150107
SHELL> ls -hltr
total 16K
drwxr-xr-x 9 root root 4.0K Jan  7 03:05 base_20150107    #全备
drwxr-xr-x 9 root root 4.0K Jan  8 03:04 inc_20150108    #增备
drwxr-xr-x 9 root root 4.0K Jan  9 03:03 inc_20150109    #增备
drwxr-xr-x 9 root root 4.0K Jan 10 03:03 inc_20150110    #增备

MySQL管理之使用XtraBackup进行热备

MySQL开源备份工具Xtrabackup备份部署

MySQL Xtrabackup备份和恢复

用XtraBackup实现MySQL的主从复制快速部署【主不锁表】

安装和使用 Percona 推出的 Xtrabackup 备份 MySQL

XtraBackup 的详细介绍请点这里
XtraBackup 的下载地址请点这里

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/ad182560eb1d58a6a6f4efdd89adfbc5.html