In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Refer to the script in smear mysql and make some improvements.
[mysql@mysql01 scripts] $cat mysql_full_backup_by_xtra.sh
#! / bin/sh
# Created by wk
DATA_PATH=/data/mysqldata/backup/mysql_full
DATA_FILE=$ {DATA_PATH} / xtra_fullbak_ `date +% Y% m% d% H% M`
LOG_FILE=$ {DATA_PATH} / xtra_fullbak_ `date +% Y% m% d% H% M`.log
ORI_CONF_FILE=/data/mysqldata/3306/my.cnf
NEW_CONF_FILE=$ {DATA_PATH} / my_3306_ `date +% Y% m% d% H% M`.cnf
MYSQL_PATH=/data/mysqldata/backup/innobackupex/bin
MYSQL_CMD= "${MYSQL_PATH} / innobackupex-- user=root-- password=pass1-- defaults-file=/data/mysqldata/3306/my.cnf-- no-lock-- no-timestamp ${DATA_FILE}"
Echo > $LOG_FILE
Echo-e "= Jobs started at `date +% F'% T''% w` =\ n" > > $LOG_FILE
Echo-e "= First cp my.cnf file to backup directory =" > > $LOG_FILE
/ bin/cp ${ORI_CONF_FILE} ${NEW_CONF_FILE}
Echo > > $LOG_FILE
# echo-e "* Executed command:$ {MYSQL_CMD} | gzip > ${DATA_FILE}" > $LOG_FILE
${MYSQL_CMD} 2 > > ${LOG_FILE}
Echo-e "* Executed finished at `date +% F'% T''% w` =" > > $LOG_FILE
Echo-e "* Backup file size: `du-sh ${DATA_FILE} `=\ n" > > ${LOG_FILE}
Echo-e "- Find expired backup and delete those files -" > > ${LOG_FILE}
For tfile in $(/ usr/bin/find $DATA_PATH/-mtime + 6)
Do
If [- d $tfile]; then
Rmdir $tfile
Elif [- f $tfile]; then
Rm-f $tfile
Fi
Echo-e "- Delete tfile: $tfile -" > > ${LOG_FILE}
Done
Echo-e "\ nthanks thanks = Jobs ended at `date +% F'% T''% w` =\ n" > > $LOG_FILE
Echo "backup_full=$ {DATA_FILE}" > / data/mysqldata/scripts/backup.conf
Echo "backup_pre_name=$ {DATA_FILE}" > > / data/mysqldata/scripts/backup.conf
[mysql@mysql01 scripts] $cat mysql_incr_backup_by_xtra.sh
#! / bin/sh
# Created by wk
Source / data/mysqldata/scripts/backup.conf
DATA_PATH=/data/mysqldata/backup/mysql_full
DATA_FILE=$ {DATA_PATH} / xtra_incrbak_ `date +% Y% m% d% H% M`
# OLD_DATA_FILE=$ {DATA_PATH} / xtra_fullbak_ `date-d "1 days ago" + "% F" `
LOG_FILE=$ {DATA_PATH} / xtra_incrbak_ `date +% Y% m% d% H% M`.log
ORI_CONF_FILE=/data/mysqldata/3306/my.cnf
NEW_CONF_FILE=$ {DATA_PATH} / my_3306_ `date +% Y% m% d% H% M`.cnf
MYSQL_PATH=/data/mysqldata/backup/innobackupex/bin
MYSQL_CMD= "${MYSQL_PATH} / innobackupex-- user=root-- password=pass1-- defaults-file=/data/mysqldata/3306/my.cnf-- incremental-- no-lock-- no-timestamp
-- incremental-basedir=$ {backup_pre_name} ${DATA_FILE} "
Echo > $LOG_FILE
Echo-e "= Jobs started at `date +% F'% T''% w` =\ n" > > $LOG_FILE
Echo-e "= First cp my.cnf file to backup directory =" > > $LOG_FILE
/ bin/cp ${ORI_CONF_FILE} ${NEW_CONF_FILE}
Echo > > $LOG_FILE
Echo-e "* Executed command:$ {MYSQL_CMD} | gzip > ${DATA_FILE}" > $LOG_FILE
${MYSQL_CMD} 2 > > ${LOG_FILE}
Echo-e "* Executed finished at `date +% F'% T''% w` =" > > $LOG_FILE
Echo-e "* Backup file size: `du-sh ${DATA_FILE} `=\ n" > > ${LOG_FILE}
Echo-e "- Find expired backup and delete those files -" > > ${LOG_FILE}
For tfile in $(/ usr/bin/find $DATA_PATH/-mtime + 6)
Do
If [- d $tfile]; then
Rmdir $tfile
Elif [- f $tfile]; then
Rm-f $tfile
Fi
Echo-e "- Delete tfile: $tfile -" > > ${LOG_FILE}
Done
Echo-e "\ nthanks thanks = Jobs ended at `date +% F'% T''% w` =\ n" > > $LOG_FILE
Echo "backup_full=$ {DATA_FILE}" > / data/mysqldata/scripts/backup.conf
Echo "backup_pre_name=$ {DATA_FILE}" > > / data/mysqldata/scripts/backup.conf
[mysql@mysql01 scripts] $cat backup.conf
Backup_full=/data/mysqldata/backup/mysql_full/xtra_incrbak_201609011805
Backup_pre_name=/data/mysqldata/backup/mysql_full/xtra_incrbak_201609011805
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.