Percona Xtrabackup MySQL 全备

#!/bin/sh

BACKUP_TIME=`date +%Y-%m-%d-%H-%M-%S`
BACKUP_SOCK=/tmp/mysql3306.sock
BACKUP_CNF=/etc/my3306.cnf
BACKUP_USER=user
BACKUP_PWD=123456
BACKUP_DB=employees
BACKUP_DIR=/data/backup/mysql/backup3306/

BAK=${BACKUP_DIR}${BACKUP_DB}_${BACKUP_TIME}
INNOBACKUPEX=/opt/soft/xtrabackup-1.6.6/innobackupex

${INNOBACKUPEX} --defaults-file=${BACKUP_CNF} --socket=${BACKUP_SOCK} --user=${BACKUP_USER} --password=${BACKUP_PWD} ${BAK} --no-timestamp
#${INNOBACKUPEX} --defaults-file=${BACKUP_CNF} --socket=${BACKUP_SOCK} --user=${BACKUP_USER} --password=${BACKUP_PWD} ${BAK} --no-timestamp --stream=tar > ${BAK}.tar
#${INNOBACKUPEX} --defaults-file=${BACKUP_CNF} --apply-log --use-memory=4G ${BAK}

cd ${BACKUP_DIR}
tar zcf ${BACKUP_DB}_${BACKUP_TIME}.tar.gz ${BACKUP_DB}_${BACKUP_TIME}
rm -rf ${BACKUP_DB}_${BACKUP_TIME}

你可能感兴趣的:(Percona Xtrabackup MySQL 全备)