Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- PATH="/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/usr/X11R6/bin"
- export PATH
- BASE=/home/mysql.xtrabackup
- echo `date` Starting backup.
- rm -rf ${BASE}/*
- ulimit -n 204800
- DATABASES="`mysql -BNe 'select distinct table_schema from information_schema.tables where table_schema not in (\"information_schema\", \"apachelogs\")' | xargs echo`"
- SAFE_SLAVE="--slave-info"
- PASSWORD=`cat ~/.my.cnf | grep password | cut -f2 -d=`
- innobackupex --defaults-file=/etc/mysql/my.cnf --databases="${DATABASES}" ${BASE} --password=${PASSWORD} ${SAFE_SLAVE} > $BASE/lastlog 2>&1
- OK=`tail -1 $BASE/lastlog | grep "innobackupex: completed OK!"`
- if [ -z "$OK" ]; then echo Backup stage 1 was not OK; exit 1; fi
- DIR=`ls -1 ${BASE}/ |grep ^[0-9]`
- innobackupex ${BASE}/${DIR} --apply-log > ${BASE}/${DIR}/innobackupex.1apply-log 2>&1
- OK=`tail -1 ${BASE}/${DIR}/innobackupex.1apply-log | grep "innobackupex: completed OK!"`
- if [ -z "$OK" ]; then echo Backup stage 2 was not OK; exit 1; fi
- echo `date` Backup process finalized.
- #"CHANGE MASTER TO MASTER_HOST='172.25.10.2', MASTER_USER='repl', MASTER_PASSWORD='slavepassword', MASTER_LOG_FILE='${BIN_LOG}', MASTER_LOG_POS=${BIN_POS}; \""
- #echo `date` Please check manualy.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement