Backup & Export MariaDB servers

This chapter presents the following DMK-MariaDB backup scripts: MariaDB backup “mbackup.sh”. And MariaDB dump “mdump.sh”

The “mdump.sh” wrapper script for MariaDB dumps is launched with following option to ensure all the database are backed up in the textual backup:

-all-databases --lock-all-tables --flush-logs --master-data=2 --routines

The executions of “mdump.sh” or “mbackup.sh” requires a configuration file, which contains the following parameters.

The script requires command lines argument in addition to the configuration file. Some of the configuration file parameters are also available in command-line. The parameters given in command line are from higher priority compared to their configuration values. Which allow different behave using the same configuration file.

Example:

mdump.sh –s ${MYSQL_SERVER}
mbackup.sh –s ${MYSQL_SERVER}

Parameters

A hyphen character prefixes the command line parameters as they are be used within a shell.

–h or –help

Display the Synopsis.

–s or -–sid

The target database on which, the MariaDB dump or backup operation should be launched. This parameter is always required.

{mdump|mbackup}.sh –s ${MYSQL_SERVER}

–c or –-configfile

ℹ️The dbi services best practice consist of saving the configuration file under the database admin directory which makes the command-line parameter “ConfigFile” useless

Otherwise the command-line parameter becomes mandatory

–d or –-databasename

Optional parameter if you want to backup only one specific database.

a or --alldatabasessinglefiles

Optional parameter if you want to have a separated backup file per database.

BckPath or DumpPath

ℹ️ The DumpPath parameter belongs to the MariaDB dump script “mdump.sh”

ℹ️ The bckPath parameter belongs to the MariaDB backup script “mbackup.sh”. This script creates automatically a sub-folder for each execution (the folder name contains the start data of the backup)

⚠️ If the backup or dump directory doesn’t exist, the MariaDB operation will abort!

LogPath

Compress

ℹ️ The compress option is only available for the MariaDB dump script “mdump.sh”

PreScript

PostScript

Customer

NoSuccessMail

MailRecipients

SmtpServer

MailFrom

Last updated