Add ignore database option, add possibility to configure list of db names #973

Closed
opened 2025-01-21 09:48:25 +00:00 by powerriegel · 5 comments

What I'd like to do and why

Currently, It's not possible to simply ignore databases for backup when selecting all databases.

For MariaDB, setting options: --ignore_database foo does not work, as the all option does not hand over --all-databases to m̀ariadb-dump but dumps each DB for it's own. The option works only with the --all-databases parameter.

Other notes / implementation ideas

It would also be nice to be able to configure a list of database names without requiring to configure host, user and password for each DB. This makes borgmatic difficult to use for large database servers.

### What I'd like to do and why Currently, It's not possible to simply ignore databases for backup when selecting `all` databases. For MariaDB, setting `options: --ignore_database foo` does not work, as the `all` option does not hand over `--all-databases` to `m̀ariadb-dump` but dumps each DB for it's own. The option works only with the `--all-databases` parameter. ### Other notes / implementation ideas It would also be nice to be able to configure a list of database names without requiring to configure `host`, `user` and `password` for each DB. This makes borgmatic difficult to use for large database servers.
Owner

For MariaDB, setting options: --ignore_database foo does not work, as the all option does not hand over --all-databases to m̀ariadb-dump but dumps each DB for it's own. The option works only with the --all-databases parameter.

IIRC, borgmatic dumps each database on its own so that it can filter out system databases from the "all" dump. Otherwise, trying to restore those system databases will fail upon restore.

But to support your use case, I can imagine borgmatic's config supporting an ignore_names list, optionally set for any database with name all. Then borgmatic could do the filtering out of ignored databases on its own.

It would also be nice to be able to configure a list of database names without requiring to configure host, user and password for each DB. This makes borgmatic difficult to use for large database servers.

You could probably do this with a merge include today, but I'm not sure if even that would be convenient enough for you. It might look something like this:

mariadb_databases:
    - name: mydb1
      <<: !include db_common.yaml
    - name: mydb2
      <<: !include db_common.yaml
    ...

And then db_common.yaml could contain:

host: myhost
username: myuser
password: mypass

Another idea (not implemented today) is a syntax like the following:

mariadb_databases:
    - name: [mydb1, mydb2, ...]
      host: myhost
      username: myuser
      password: mypass

Anyway, these host/username/password ideas may be best in a separate ticket.

> For MariaDB, setting options: --ignore_database foo does not work, as the all option does not hand over --all-databases to m̀ariadb-dump but dumps each DB for it's own. The option works only with the --all-databases parameter. IIRC, borgmatic dumps each database on its own so that it can filter out system databases from the "all" dump. Otherwise, trying to restore those system databases will fail upon restore. But to support your use case, I can imagine borgmatic's config supporting an `ignore_names` list, optionally set for any database with name `all`. Then borgmatic could do the filtering out of ignored databases on its own. > It would also be nice to be able to configure a list of database names without requiring to configure host, user and password for each DB. This makes borgmatic difficult to use for large database servers. You could probably do this with a [merge include](https://torsion.org/borgmatic/docs/how-to/make-per-application-backups/#include-merging) today, but I'm not sure if even that would be convenient enough for you. It might look something like this: ```yaml mariadb_databases: - name: mydb1 <<: !include db_common.yaml - name: mydb2 <<: !include db_common.yaml ... ``` And then `db_common.yaml` could contain: ```yaml host: myhost username: myuser password: mypass ``` Another idea (not implemented today) is a syntax like the following: ```yaml mariadb_databases: - name: [mydb1, mydb2, ...] host: myhost username: myuser password: mypass ``` Anyway, these `host`/`username`/`password` ideas may be best in a separate ticket.
Author

Thanks, I will try the inlude solution. It makes the configuration much shorter.

Thanks, I will try the inlude solution. It makes the configuration much shorter.
Owner

This is implemented in main and will be part of the next release! The new option is called skip_names and is implemented right now for both MariaDB and MySQL. Just add it to a given database config, and the value is a sequence of database names to ignore when dumping "all".

This is implemented in main and will be part of the next release! The new option is called `skip_names` and is implemented right now for both MariaDB and MySQL. Just add it to a given database config, and the value is a sequence of database names to ignore when dumping "all".
Author

Really happy to hear and cant wait to run the new release! Thanks a lot!

Really happy to hear and cant wait to run the new release! Thanks a lot!
Owner

Released in borgmatic 2.0.10!

Released in borgmatic 2.0.10!
Sign in to join this conversation.
No milestone
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
borgmatic-collective/borgmatic#973
No description provided.