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


# 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
DUMP_NAME="`date +%s`.$MYSQL_HOST.$MYSQL_DB.sql"
if [ -e $DUMP_FILE ]; then
log "The dump $DUMP_FILE already exists"
return 1
- 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
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

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

4 votes
Sign in Sign in with OnApp
Signed in as (Sign out)

We’ll send you updates on this idea

AdminRoman Strazhnyk (Product Manager, OnApp) shared this idea  ·   ·  Admin →

1 comment

Sign in Sign in with OnApp
Signed in as (Sign out)

Feedback and Knowledge Base