[ZODB-Dev] Backing up a ZODB

Tim Peters tim at zope.com
Wed Oct 29 17:10:45 EST 2003


[Peter Schuller]
> I've been reading quite a lot about Zope and ZODB in the past few
> days; and while it all seems like a very robust solution, I have seen
> no references in the docs on backing up a ZODB database.
>
> I've been asking around a bit on #zope and the most promising I've
> heard so far is copying Data.fs and basically hoping for the best;
> using a recovery tool afterwards. The idea being that it will work
> because filestorage just appends pickels.

That's not *quite* true, and because of it plain copying is vulnerable to
screwing up the last transaction in the database.  In the most recent
releases of ZODB 3.1 and 3.2, the repozo.py script can be used to make
backups (incremental or full -- your choice) safely.

> But what about packing? If the database is undergoing packing, surely
> this would break things.

Nope, packing writes a new file; the file it starts with isn't altered by
packing, except to get renamed with an ".old" extension at the end of
packing.

> Is there any way of making a hot backup of a ZODB - that is
> algorithmically guaranteed to yield a consistent snapshot of the
> database - without shutting down the database for the procedure?

That's repozo.py's purpose.

> If not, what do major sites do about the problem?

Zope Corp uses an up-to-date repozo.py for sites it hosts.  Read the module
docstring for usage.




More information about the ZODB-Dev mailing list