Specify database restore user / restore databases even if no database users are present #309

Open
opened 2020-05-13 04:17:40 +00:00 by witten · 1 comment
Owner

What I'm trying to do and why

In the case where a server is destroyed and completely replaced, the user story for restoring databases with borgmatic isn't super great. That's because database systems like PostgreSQL won't have any of the database users until after a restore happens, and so it'll be impossible to connect as a particular configured database user to do a restore.. until after the users are restored.. or a user is manually re-created.

Related use case: The backup database user only has permissions to read, not to create databases.

Other notes / implementation ideas

The database superuser always exists, so maybe the solution is to support database restoration as a different user than the one configured in borgmatic's database hooks.

#### What I'm trying to do and why In the case where a server is destroyed and completely replaced, the user story for restoring databases with borgmatic isn't super great. That's because database systems like PostgreSQL won't have any of the database users until after a restore happens, and so it'll be impossible to connect as a particular configured database user to do a restore.. until after the users are restored.. or a user is manually re-created. Related use case: The backup database user only has permissions to read, not to create databases. #### Other notes / implementation ideas The database superuser always exists, so maybe the solution is to support database restoration as a different user than the one configured in borgmatic's database hooks.
witten changed title from Restore databases even if no database users are present to Specify database restore user / restore databases even if no database users are present 2020-06-02 18:48:29 +00:00
Author
Owner

A few notes:

A few notes: * `borgmatic restore` does have a `--username` flag these days, which gets us part of the way there. But we'd still need a way to connect as a different database than the one we're restoring. * This might be useful for dumping/restoring roles: https://dba.stackexchange.com/questions/20986/postgresql-how-do-i-dump-and-restore-roles-for-a-cluster
Sign in to join this conversation.
No assignees
1 participant
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#309
No description provided.