Table of Contents


Example: Getting bman version and help

To just see if bman works correctly just run:

shell> bman --version

To get a compact help of what bman can do run the following command. This output is the most reliable and most up-to-date source of information about brman (documentation may not be up-to-date):

shell> bman --help

Example: Full logical backup

Do a full (logical = default) backup and store it in the daily policy folder:

shell> bman --target=brman:secret@127.0.0.1:3306 --type=full --policy=daily

Example: Full physical backup

Do a full physical backup and store it in the weekly policy folder:

shell> bman --target=brman:secret@127.0.0.1 --type=full --mode=physical --policy=weekly

Example: Full binary log backup

Do a binary log backup omitting the password in the target and store it in the binlog policy folder. The binary logs should NOT be purged during the backup (by default they would be purged):

shell> bman --target=brman@192.168.1.42:3307 --type=binlog --policy=binlog --no-purge

Example: Schema backup omitting some schemas

Do a schema backup omitting the mysql schema:

shell> bman --target=brman:secret@127.0.0.1:3306 --type=schema --schema=-mysql \
  --policy=daily --archive --archivedestination=file:///mnt/tape

Example: Schema backup of some schemas

Do a schema backup only of foodmart and world and write each backup to its own own file. Omit compressing these backups because they are located for example on deduplicated drives:

shell> bman --target=brman:secret@127.0.0.1:3306 --type=schema \
  --schema=+foodmart,+world --per-schema --policy=daily --no-compress

Example: Configuration backup into weekly policy

Do a configuration backup (my.cnf) and store it in the weekly policy folder:

shell> bman --target=brman:secret@127.0.0.1:3306 --type=config --policy=weekly

Example: Structure backup into monthly policy

Do a structure backup and store it in the monthly policy folder and name the file with the instance name:

shell> bman --target=brman:secret@127.0.0.1:3306 --type=structure --policy=monthly \
  --instance-name=prod-db

Example: Weekly structure backup to other location

Do a weekly structure backup and archive it to an other backup location:

shell> bman --target=brman:secret@127.0.0.1:3306 --type=structure --policy=weekly \
  --archive --archivedestination=file:///mnt/tape

Example: Privilege backup

Do a weekly privilege backup:

shell> bman --target=brman:secret@127.0.0.1:3306 --type=privilege --policy=weekly \
  --mode=logical

Example: Privilege backup per schema

Do a daily privilege backup per schema:

shell> bman --target=brman:secret@127.0.0.1:3306 --type=privilege --policy=daily \
--per-schema

Example: Archiving an Cleaning

Archive backup to other location:

shell> bman --target=brman:secret@127.0.0.1:3306 --type=structure --policy=weekly \
  --archive --archivedestination=file:///mnt/tape --cleanup

Cleanup old backups:

shell> bman --target=brman:secret@127.0.0.1:3306 --type=cleanup --policy=daily \
  --retention=30d

Cleanup old backups from archive location:

shell> bman --target=brman:secret@127.0.0.1:3306 --type=cleanup --policy=daily \
  --retention=30d --archive --archivedestination=file:///mnt/nfsmount

Example: Backup shipping

If you want to ship your backup to an other (backup) server after database backup you can use the option --archivedestination. The protocols file, scp, sftp and rsync are supported:

shell> bman --target=brman:secret@127.0.0.1:3306 --type=full --policy=daily \
  --archivedestination=sftp://backup@backup.example.com:22/home/backup/production/daily/

Example: Other options (pass-through)

If you want to pass through options to the underlying backup utility (mysqldump, mariabackup, xtrabackup, mysqlbackup) you can use the --pass-through option. In the following example the mysqldump utility omits dumping the CountryLanguage table in a world schema backup:

shell> bman --target=brman:secret@127.0.0.1:3306 --type=schema --mode=logical --policy=daily \
  --schema=+world --pass-through="--ignore-table=world.CountryLanguage"

Example: Monitoring integration (fpmmm)

If you are using the FromDual Performance Monitor for MariaDB and MySQL (fpmmm) and/or Zabbix for database monitoring you can send the backup information also to your monitoring solution for getting trends and see errors or anomalies:

shell> bman --target=brman:secret@127.0.0.1:3306 --type=full --policy=daily \
  --fpmmm-hostname=mariadb-103 --fpmmm-cache-file=/var/cache/fpmmm/fpmmm.FromDual.mariadb-103.cache

Example: Backup Catalog

Creation of a backup catalog (assuming you have created already a catalog schema with the default name brman_catalog):

shell> bman --catalog=brman:secret@127.0.0.1:3306 --create

Backups against catalog:

shell> bman --target=brman:secret@127.0.0.1:3306 --catalog=brman:secret@127.0.0.1:3306 \
  --instance-name=test --type=full --policy=daily

Example: Excluding a table or a schema from backup

If you want to exclude one or several tables from a logical brman backup you can use the --pass-through option:

shell> bman --target=brman:secret@127.0.0.1:3306 --type=schema --mode=logical \
  --policy=daily --schema=+world --pass-through="--ignore-table=world.CountryLanguage"

If you prefer a configuration file instead use this:

#
# /etc/brman.conf
#

target             = brman:secret@127.0.0.1:3306
type               = schema
mode               = logical
policy             = daily
schema             = +world
pass-through       = --ignore-table=world.CountryLanguage