docker-db-backup icon indicating copy to clipboard operation
docker-db-backup copied to clipboard

Postgres: no roles are backed up when SPLIT_DB is set

Open joergmschulz opened this issue 3 years ago • 7 comments
trafficstars

no roles backed up

Postgres: when we use SPLIT_DB, the databases are backed up perfectly and could be restored. BUT: the roles and their passwords are not backed up.

Suggestion: run a pg_dumpall -r after all backups.

joergmschulz avatar Jul 07 '22 19:07 joergmschulz

Sure, that makes sense to me. Are you able to try tiredofit/db-backup:develop to see if it does what you are after?

You should see an additional file following the syntax of pgsql_roles_(db_host)_(timestamp).sql.(yourcompressiontype) post backup.

tiredofit avatar Jul 07 '22 20:07 tiredofit

this looks pretty good. The user info is there, the CREATE DATABASE not. My bad: I should have requested pg_dumpall -g (same as --globals-only) instead.

joergmschulz avatar Jul 08 '22 08:07 joergmschulz

No problem. I have a new :develop ready for a test.

tiredofit avatar Jul 08 '22 15:07 tiredofit

That's somewhat better; I should have tested pg_dumpall better. We need just another command: pg_dumpall -s creates the schemas and tables (the latter is included in the pg_dump of the schemas). A complete restore then would need the globals, the schemas and then the content files for each schema. In some weeks I'll have another free machine to do a complete recovery test....

joergmschulz avatar Jul 08 '22 18:07 joergmschulz

Sure not a problem. I can add the -s easy enough. I'm going to change the filenames and add a duplicate __ in front of the segment where the dbname is eg (pgsql__globals) and the schemas to avoid any conflicts. I'll add -s and push out a new :develop release shortly.

tiredofit avatar Jul 08 '22 19:07 tiredofit

a restore to another machine worked using psql. The restore script told me psql wouldn't be possible. When this fine stuff is made public on github (no devel branch there), I can dig a bit. There are some databases to be migrated to another machine...

joergmschulz avatar Jul 11 '22 19:07 joergmschulz

Sure thing, have a peek at the develop branch that is now available for you.

tiredofit avatar Jul 11 '22 19:07 tiredofit