Skip to content

Commit

Permalink
add --max-allowed-packet=500M to all mysqldump
Browse files Browse the repository at this point in the history
  • Loading branch information
Schnitzel committed Jan 7, 2019
1 parent 2071d1a commit 1c8f8b0
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion helpers/annotate-pvc-backup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
oc get pvc --all-namespaces | grep solr | sed '1d' | awk '{ print $2, "--namespace", $1 }' | while read line; do oc annotate --overwrite pvc $line appuio.ch/backup="true"; done
oc get pvc --all-namespaces | grep nginx | sed '1d' | awk '{ print $2, "--namespace", $1 }' | while read line; do oc annotate --overwrite pvc $line appuio.ch/backup="true"; done

oc get --all-namespaces pod -l 'service in (cli)' | sed '1d' | awk '{ print "--namespace", $1, $2 }' | while read line; do oc annotate --overwrite pod $line appuio.ch/backupcommand='/bin/bash -c "if [[ $MARIADB_HOST ]]; then mysqldump --events --routines --quick --add-locks --no-autocommit --single-transaction --no-create-db -h $MARIADB_HOST -u $MARIADB_USERNAME -p$MARIADB_PASSWORD $MARIADB_DATABASE; fi"'; done
oc get --all-namespaces pod -l 'service in (cli)' | sed '1d' | awk '{ print "--namespace", $1, $2 }' | while read line; do oc annotate --overwrite pod $line appuio.ch/backupcommand='/bin/bash -c "if [[ $MARIADB_HOST ]]; then mysqldump --max-allowed-packet=500M --events --routines --quick --add-locks --no-autocommit --single-transaction --no-create-db -h $MARIADB_HOST -u $MARIADB_USERNAME -p$MARIADB_PASSWORD $MARIADB_DATABASE; fi"'; done
2 changes: 1 addition & 1 deletion helpers/mariadb-single2shared.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ DB_PORT=$(cat $SECRETS | shyaml get-value data.DB_PORT | base64 -D)

echo "*** Transfering 'drupal' database from $OLD_POD to $DB_HOST"
# transfer database between from old to new
oc exec $OLD_POD -- bash -c "mysqldump --no-create-db drupal | mysql -h $DB_HOST -u $DB_USER -p${DB_PASSWORD} -P $DB_PORT $DB_NAME"
oc exec $OLD_POD -- bash -c "mysqldump --max-allowed-packet=500M --events --routines --quick --add-locks --no-autocommit --single-transaction --no-create-db drupal | mysql -h $DB_HOST -u $DB_USER -p${DB_PASSWORD} -P $DB_PORT $DB_NAME"

CONFIG_BAK="/tmp/${PROJECT_NAME}-$(date +%F-%T)-lagoon-env.yaml"
echo "*** Backing up configmap in case we need to revert: ${CONFIG_BAK}"
Expand Down
2 changes: 1 addition & 1 deletion images/mariadb-galera/mysql-backup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ function backup_database(){
backup_file="$BACKUP_DIR/$TIMESTAMP.$database.sql.gz"
output="${output}${database} => $backup_file\n"
echo_status "...backing up $count of $total databases: $database"
$(mysqldump --events --routines --quick --add-locks --no-autocommit --single-transaction $(mysql_login) $database | gzip -9 > $backup_file)
$(mysqldump --max-allowed-packet=500M --events --routines --quick --add-locks --no-autocommit --single-transaction $(mysql_login) $database | gzip -9 > $backup_file)
}

function backup_databases(){
Expand Down
2 changes: 1 addition & 1 deletion images/mariadb/mysql-backup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ function backup_database(){
backup_file="$BACKUP_DIR/$TIMESTAMP.$database.sql.gz"
output="${output}${database} => $backup_file\n"
echo_status "...backing up $count of $total databases: $database"
$(mysqldump --events --routines --quick --add-locks --no-autocommit --single-transaction $(mysql_login) $database | gzip -9 > $backup_file)
$(mysqldump --max-allowed-packet=500M --events --routines --quick --add-locks --no-autocommit --single-transaction $(mysql_login) $database | gzip -9 > $backup_file)
}

function backup_databases(){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ objects:
template:
metadata:
annotations:
appuio.ch/backupcommand: /bin/sh -c "if [[ $MARIADB_HOST ]]; then mysqldump --events --routines --quick --add-locks --no-autocommit --single-transaction --no-create-db -h $MARIADB_HOST -u $MARIADB_USERNAME -p$MARIADB_PASSWORD $MARIADB_DATABASE; fi"
appuio.ch/backupcommand: /bin/sh -c "if [[ $MARIADB_HOST ]]; then mysqldump --max-allowed-packet=500M --events --routines --quick --add-locks --no-autocommit --single-transaction --no-create-db -h $MARIADB_HOST -u $MARIADB_USERNAME -p$MARIADB_PASSWORD $MARIADB_DATABASE; fi"
backup.appuio.ch/file-extension: .mysql.sql
creationTimestamp: null
labels:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ objects:
template:
metadata:
annotations:
appuio.ch/backupcommand: /bin/sh -c "if [[ $MARIADB_HOST ]]; then mysqldump --events --routines --quick --add-locks --no-autocommit --single-transaction --no-create-db -h $MARIADB_HOST -u $MARIADB_USERNAME -p$MARIADB_PASSWORD $MARIADB_DATABASE; fi"
appuio.ch/backupcommand: /bin/sh -c "if [[ $MARIADB_HOST ]]; then mysqldump --max-allowed-packet=500M --events --routines --quick --add-locks --no-autocommit --single-transaction --no-create-db -h $MARIADB_HOST -u $MARIADB_USERNAME -p$MARIADB_PASSWORD $MARIADB_DATABASE; fi"
backup.appuio.ch/file-extension: .mysql.sql
creationTimestamp: null
labels:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ objects:
template:
metadata:
annotations:
appuio.ch/backupcommand: /bin/sh -c "mysqldump --events --routines --quick --add-locks --no-autocommit --single-transaction --all-databases"
appuio.ch/backupcommand: /bin/sh -c "mysqldump --max-allowed-packet=500M --events --routines --quick --add-locks --no-autocommit --single-transaction --all-databases"
backup.appuio.ch/file-extension: .${SERVICE_NAME}.sql
creationTimestamp: null
labels:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ objects:
template:
metadata:
annotations:
appuio.ch/backupcommand: /bin/sh -c "mysqldump --events --routines --quick --add-locks --no-autocommit --single-transaction --all-databases"
appuio.ch/backupcommand: /bin/sh -c "mysqldump --max-allowed-packet=500M --events --routines --quick --add-locks --no-autocommit --single-transaction --all-databases"
backup.appuio.ch/file-extension: .${SERVICE_NAME}.sql
creationTimestamp: null
labels:
Expand Down

0 comments on commit 1c8f8b0

Please sign in to comment.