From d215f430cd8b7652d9f866c99cdf03e5419c072d Mon Sep 17 00:00:00 2001 From: abednarik Date: Mon, 3 Oct 2016 15:48:53 -0300 Subject: [PATCH 1/3] When detecting innobackupex version, just parse the first line. --- s3backup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/s3backup b/s3backup index ee7be96..0bab5d2 100755 --- a/s3backup +++ b/s3backup @@ -135,7 +135,7 @@ __check_mysql_credentials () { # --- Function: __check_xtrabackup_version __check_xtrabackup_version () { local CURRENT_VERSION - CURRENT_VERSION=$($IBEX_CMD --version 2>&1 | sed -e 's/[^0-9.]*\([0-9.]*\).*/\1/' -e 's/\.//g' ) + CURRENT_VERSION=$($IBEX_CMD --version 2>&1 | head -n1 | sed -e 's/[^0-9.]*\([0-9.]*\).*/\1/' -e 's/\.//g' ) if [ "$CURRENT_VERSION" -lt "$MINOR_SUPPORTED_VERSION" ] then echoerror "Please install xtrabackup 2.3 or higher." From 22e2391b0c01af6c9bb94075ae53a1026f0b4a2f Mon Sep 17 00:00:00 2001 From: Alejandro Bednarik Date: Mon, 3 Oct 2016 17:16:21 -0300 Subject: [PATCH 2/3] Update s3backup Update minimal version. --- s3backup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/s3backup b/s3backup index 0bab5d2..c2d1e79 100755 --- a/s3backup +++ b/s3backup @@ -39,7 +39,7 @@ KEYFILE="${S3BACKUP_DIR}/key" LOCKFILE="${S3BACKUP_DIR}/lock" LOGFILE="/var/log/s3backup.log" CURRENT_DATE=$(date +%Y%m%d) -MINOR_SUPPORTED_VERSION="23" +MINOR_SUPPORTED_VERSION="230" TRUE="1" FALSE="0" From 0bffc97d21a79020b609dc8df7a053142cfe3ba6 Mon Sep 17 00:00:00 2001 From: Alejandro Bednarik Date: Wed, 5 Oct 2016 08:06:16 -0300 Subject: [PATCH 3/3] Update s3backup Add options --no-lock --slave-info --safe-slave-backup when running backup --- s3backup | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/s3backup b/s3backup index c2d1e79..d623a6a 100755 --- a/s3backup +++ b/s3backup @@ -233,24 +233,24 @@ case $CMD in echoerror "MySQL service is not running!. Please ensure mysql is running before running a backup." fi __check_mysql_credentials - echoinfo "Backup in progress, please wait. Log written to ${LOGFILE}" - touch "${LOCKFILE}" || echoerror "Failed to create lock file. Please review the configuration." - ${IBEX_CMD} --encrypt=AES256 --encrypt-key-file="${KEYFILE}" --stream=xbstream --compress --user=${MYSQL_USER} --password=${MYSQL_PASSWORD} . 2>>"${LOGFILE}" | $PV_CMD | ${GOF3R_CMD} put -b "${S3_BUCKET_NAME}" --endpoint="${AWS_REGION}" -k "${S3_BACKUP_PATH}"/"${CURRENT_DATE}"/"${S3_BACKUP_NAME}".xbcrypt - STATUS=(${PIPESTATUS[@]}) - IBEX_STATUS=${STATUS[0]} - S3_STATUS=${STATUS[1]} - if [ "$IBEX_STATUS" -ne 0 ] - then - echoerror "Xtrabackup failure!. Plese check the log and try again." - fi - if [ "$S3_STATUS" -ne 0 ] - then - echoerror "S3 Bucket Transfer failed!" - fi - echoinfo "Upload of ${S3_BACKUP_NAME}.xbcrypt to path ${S3_BACKUP_PATH}/${CURRENT_DATE} on Bucket ${S3_BUCKET_NAME} complete" - rm -f "${LOCKFILE}" - exit 0 - ;; + echoinfo "Backup in progress, please wait. Log written to ${LOGFILE}" + touch "${LOCKFILE}" || echoerror "Failed to create lock file. Please review the configuration." + ${IBEX_CMD} --encrypt=AES256 --encrypt-key-file="${KEYFILE}" --no-lock --slave-info --safe-slave-backup --stream=xbstream --compress --user=${MYSQL_USER} --password=${MYSQL_PASSWORD} . 2>>"${LOGFILE}" | $PV_CMD | ${GOF3R_CMD} put -b "${S3_BUCKET_NAME}" --endpoint="${AWS_REGION}" -k "${S3_BACKUP_PATH}"/"${CURRENT_DATE}"/"${S3_BACKUP_NAME}".xbcrypt + STATUS=(${PIPESTATUS[@]}) + IBEX_STATUS=${STATUS[0]} + S3_STATUS=${STATUS[1]} + if [ "$IBEX_STATUS" -ne 0 ] + then + echoerror "Xtrabackup failure!. Plese check the log and try again." + fi + if [ "$S3_STATUS" -ne 0 ] + then + echoerror "S3 Bucket Transfer failed!" + fi + echoinfo "Upload of ${S3_BACKUP_NAME}.xbcrypt to path ${S3_BACKUP_PATH}/${CURRENT_DATE} on Bucket ${S3_BUCKET_NAME} complete" + rm -f "${LOCKFILE}" + exit 0 + ;; restore|full-restore) if [ -z "$2" ] then