Specify path for database dump/restore commands #311
Loading…
x
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What I'm trying to do and why
As a user doing database dumps and restores, I want to be able to specify the path to the various dump/restore binaries (
pg_dump
,pg_restore
,mysql
, etc.) in the borgmatic configuration file. The idea is that these binaries may not be on the default path, or I may want to select different ones than those on the default path.Work-around: Manipulate the shell
PATH
before invoking borgmatic.Other notes / implementation ideas
This could work similarly to the existing Borg
local_path
/remote_path
options. One challenge is that there are multiple different binaries, not just one. So maybe specifying the folder containing all of them (per database hook) would be better.@witten this feature would be very helpful for our use case, where we have different mariadb (versions 5 and 10) and firebirdsql (versions 2.5 and 3) instances running in docker containers which are not reachable from the host but only within their isolated docker network.
In our home brew backup scripts we define these commands for database dumping:
CMD_MYSQLDUMP="/usr/bin/docker exec -t stack-somestack_mariadb_1 /usr/bin/mysqldump"
This dumps the database by executing the appropriate mysqldump within the running database container, dumping it to stdout.
The restore command works similarly by piping the dump via stdin to the mysql command within the container.
And it would be great to allow for indidvidual database configurations like
This would allow for very individual configurations, not only tied to postgresql or mysql, as long as there are command line tools available which could be used to dump and restore from/to stdin/stdout. Or, if filenames have to be involved, some filename expansion like ${filename} or similar where borgmatic could create some temporary usable filename.
Just released for PostgreSQL in borgmatic 1.7.5! I'll leave this ticket open to cover the other database hooks.
shivansh02 added custom command options for MariaDB and MySQL. So now all that remains is adding custom command support for the SQLite and MongoDB hooks. Rather than leave this ticket open even longer, I'll file separate tickets for that work.
Released in borgmatic 1.8.9!