You are here

FromDual Backup Manager (bman)

Table of Contents

Where can bman help you

The intention of bman is to assist you in bigger MariaDB/MySQL set-ups where you have to follow some backup policies and where you need a serious backup concept.

bman example

To give you an impression of the power of the FromDual Backup Manager let us have a look at a little example:

shell> bman --target=brman:secret@ --type=full --mode=logical --policy=daily \
--no-compress --backupdir=/mnt/slowdisk \
--archive --archivedestination=file:///mnt/nfsmount

With this backup method we do a logical full backup (mysqldump is triggered in the background). The backup is stored in the location for backups with the daily policy and is NOT compressed to speed up the backup by saving CPU power AND because the backup device is a de-duplicating drive. Then the backup is archived to and NFS mount.

Backup types

To achieve this we have defined different backup types:

fullDo a full logical or physical backup (mysqldump/mysqlbackup/mariabackup/xtrabackup) of all schemas.
binlogDo a binary log backup.
configDo configuration file backup (my.cnf).
structureDo a structure backup (no data).
cleanupDo a clean-up of backups older than n days.
schemaDo backup of one or more schemas (together or separated).
privilegeDo a privilege backup (SHOW GRANTS FOR).

A backup type is specified with the option --type=<backup_type>.

Backup modes

A backup can either be logical or physical. A logical backup is typically what you do with mysqldump. A physical backup is typically a physical file copy without looking into the data. That is what for example mariabackup does.

The backup mode is specified with the option --mode=<backup_mode>. The following backup modes are available:

logicalDo a logical backup (mysqldump).
physicalDo a physical backup (mysqlbackup/mariabackup/xtrabackup).

Backup policies

Further we have introduced different backup policies. Policies are there to distinguish how different backups should be treated.

The following backup policies exist:

dailyDirectory to store daily backups.
weeklyDirectory to store weekly backups.
monthlyDirectory to store monthly backups.
quarterlyDirectory to store quarterly backups.
yearlyDirectory to store yearly backups.
binlogDirectory to store binary log backups.

For example you could plan to do a daily MariaDB/MySQL backup with binary logs with a retention policy of 7 days. But once a week you want to do a weekly backup consisting of a full backup, a configuration backup and a structure dump. But this weekly backup you want to keep for 6 months. And because of legal reasons you want to do a yearly backup with a retention policy of 10 years.

A backup policy is specified with the --policy=<backup_policy> option. This leads us to the retention time:


The retention time which should be applied to a specific backup policy you can specify with the option --retention=<period_in_days>. The retention option means that a backup is not deleted before this amount of days when you run a clean-up job with bman.

Let us do an example:

shell> bman --type=cleanup --policy=daily --retention=30

This means that all backups in the daily policy should be deleted when they are older than 30 days.


With the --target option you specify the connect string to the database to backup. This database can be located either local (all backup types can be used) or remote (only client/server backup types can be used (mysqldump)).

A target looks as follows: user:password@host:port (similar to URI specification) whereas you can omit password and port.

Backup location, archiving, compressing and clean-up

The --backupdir option controls the location of the backup files. The policy folders (daily, weekly, monthly, quarterly and yearly) are automatically created under the --backupdir location.
If you have a second layer of backup stores (also called archive stores for example tapes or slow backup drives or de-duplicated drives or NFS drives) you can use the --archive option to copy your backup files to this second layer storage which is specified with the --archivedestination option. For faster restores it is recommended to always keep one or two generations of backups on your fast local drive.
If you want to remove (clean-up) the backuped files from the --backupdir destination after the archive job has completed use the --cleanup option.
If you want to remove (clean-up) the archived files from the archive location (--archivedestination) use the option --archive in combination with --type=cleanup.
If you want to omit to compress backups, either to safe time or because your location uses de-duplicated drives you can use the --no-compress option.

Per schema backup

Especially for shared hosting companies (or multi tenant applications) a full database backup is typically not the right backup strategy because a restore of one specific customer (= schema) is very complicated. For this case we have the --per-schema option. bman will do a backup of the whole database schema by schema. Keep in mind: This breaks consistency among schemas!

Sometimes you want to do a schema backup only for some specific schemas for this you can use the --schema option. This option allows you to specify schemas to backup or not to backup. --schema=+a,+b means backup schema a and b. --schema=-a,-b means backup all schemas except a and b.
The second variant is less error prone because you do not forget to backup a new schema.

Instance name

MariaDB/MySQL does not know the concept of naming an instance (mysqld). But for bigger environments it could be useful to uniquely name each instance. For this purpose we have introduced the option --instance-name=<give_it_a_name>. This instance name should be unique within your whole company. But we do not enforce it atm. The instance name is used to name backup files and later to identify the backup history of an instance in our backup catalog and to allow us to track the files for restore.

bman configuration file

Specifying everything on the command line is cumbersome. Thus bman considers a configuration file specified with the --config=<config_file> option.
A bman configuration file looks for example as follows:

policy                = daily
target                = brman:secret@
type                  = schema
schema                = -mysql
archive               = on
archivedestination    = file:///mnt/tape
per-schema            = on
no-compress           = on
no-memory-table-check = on

Simulate what happens

For the Sissies among us (as for example me) we have the --simulate option. This option simulates nearly all steps as far as possible without executing really anything. This option is either for testing some features or for debugging purposes.


If you want to track your backup history you can specify with the --log option where your bman log file should be located.

Using Catalog

It will be very useful when you can store your backups metadata in the database so you can check them in the future and to find out the backup criteria (type, mode, instance-name, ... etc) for specific backup processes. This could be achieved by using the catalog feature.

To activate this feature you have to create a schema for the catalog "default name is brman_catalog" then create its tables by using the option --create in a special bman command (check examples below).
Finally, to store your backup metadata in the catalog what you only have to do is adding the option --catalog=catalog_connection_string to the normal bman command.
Check the examples below for using catalog in bman.

Special cases and workarounds

If your application is dropping tables during your bman Backup and bman is returning errors you find here some workarounds: Dropped Tables with FromDual Backup Manager.