[clug] database backups with git

Grant Allen gxallen at gmail.com
Thu Jun 7 20:15:31 MDT 2012


On 7/06/2012 21:46, Robert Edwards wrote:
> I have been playing with keeping daily text dumps of my database in
> git, in lieu of rotating or date-stamping them. I haven't seen many
> references on the web about people doing this. Is it a good idea or
> no?

Bob, the only thing you need to worry about with using source control or similar systems is this:  have you successfully practiced a restore with such an arrangement?

Technically, what you've got is a data dump (I assume from something like pg_dumpall), rather than a more capable hot backup.  Can you extract your data dump from git, and recreate your database?  (that's almost rhetorical ... yes, you can.  Git thankfully doesn't inject crazy header data into the file or anything like that ... I'm looking at you CVS).  Try it.  Actually do it on a completely vanilla system, with no postgres and no history of your database, and satisfy yourself that you can restore.  Backups are nothing.  Restores are everything.

And then explore pg_start_backup, filesystem copies, and WAL archiving :)  But that can wait for another day.

Ciao
Fuzzy
:-)


More information about the linux mailing list