Explain how we could improve existing OnApp functionality, and how it would help you.

Gzip hourly database dumps immediately for reduced temp space and shorter runtime

When the OnApp database grows large, the hourly dump (done by /onapp/onapp-cp-install/onapp-database-dump.sh) consumes more temp space than necessary. In my case, the uncompressed dump is around 1GB, and the compressed size is around 400MB. During the dump this will require a total of 1.4GB free space to accommodate the dump followed by the compression. By piping the dump directly into gzip, the space required during backups is reduced to the size of the compressed file. As a bonus, in my case, this cuts down the runtime of the script by about two minutes as well.

The patch below is against 5.5.10, and has been tested to work ("works-for-me").

# rpm -qf /onapp/onapp-cp-install/onapp-database-dump.sh
onapp-cp-install-5.5-10.noarch

Diff:

# diff -u /onapp/onapp-cp-install/onapp-database-dump.sh.orig /onapp/onapp-cp-install/onapp-database-dump_pipegzip.sh
--- /onapp/onapp-cp-install/onapp-database-dump.sh.orig 2018-09-26 12:17:13.304437962 +0200
+++ /onapp/onapp-cp-install/onapp-database-dump_pipegzip.sh 2018-09-26 12:14:31.878175359 +0200
@@ -135,13 +135,13 @@
mkdir -p $DUMP_DIR || return 0
fi
DUMP_NAME="`date +%s`.$MYSQL_HOST.$MYSQL_DB.sql"
- DUMP_FILE="${DUMP_DIR}/${DUMP_NAME}"
+ DUMP_FILE="${DUMP_DIR}/${DUMP_NAME}.gz"
if [ -e $DUMP_FILE ]; then
log "The dump $DUMP_FILE already exists"
return 1
fi
- log "Dumping MySQL database $MYSQL_DB on $MYSQL_HOST to the file $DUMP_FILE ..."
- mysqldump -u $MYSQL_USER --password="$MYSQL_PASSWD" -h "$MYSQL_HOST" -P ${MYSQL_PORT} $MYSQL_DB --single-transaction --quick --max_allowed_packet=500M 2>/dev/null >$DUMP_FILE || return 0
+ log "Dumping and packing MySQL database $MYSQL_DB on $MYSQL_HOST to the file $DUMP_FILE ..."
+ mysqldump -u $MYSQL_USER --password="$MYSQL_PASSWD" -h "$MYSQL_HOST" -P ${MYSQL_PORT} $MYSQL_DB --single-transaction --quick --max_allowed_packet=500M 2>/dev/null | gzip - > ${DUMP_FILE} || return 0
else
log "No OnApp Control Panel database named '$MYSQL_DB' found on $MYSQL_HOST"
return 0
@@ -161,15 +161,12 @@

chown ${ONAPP_USER}:${ONAPP_USER} ${DUMP_FILE} || return 0

- log "Packing the dump ${DUMP_NAME} with gzip"
- gzip ${DUMP_FILE} || return 0
-
log "Packing other dumps"
for file in `ls -1 ${DUMP_DIR}/*.sql 2>/dev/null`; do
gzip $file
done

- move_to_backup_server "${DUMP_FILE}.gz"
+ move_to_backup_server "${DUMP_FILE}"
if [ $? -ne 1 ]; then
return 0
fi

3 votes
Sign in
Signed in as (Sign out)

We’ll send you updates on this idea

AdminRoman Strazhnyk (Product Manager, OnApp) shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

0 comments

Sign in
Signed in as (Sign out)
Submitting...

Feedback and Knowledge Base