[Zope] Backing up Zope's database?

Paul Everitt Paul@digicool.com
Wed, 24 Feb 1999 09:39:30 -0500


Martijn wrote:
> I briefly saw the pack operation but I had no clue that it 
> could be used

It isn't supposed to be used for backup purposes, just like Python
wasn't written to be the world's best desktop calculator.  It just
turned out that way.

> for backup purposes. Generally things that say 'remove' as in 'remove
> object revisions that are older than X days' don't associate with
> 'backup' in my mind.

Zope doesn't have a "make a backup file facility".  Packing just happens
to make a backup file.  If what is really wanted is a "make a backup
file facility", this would be an easy project for the community to
submit some patches.
 
> What does removing object revisions older than X days *mean*? 
> Does that
> mean only previous revisions get removed, but the current state of the
> object is saved? I presume this is so, but my suggestion is 

Correct.

> we need some
> clear documentation on this, as right now it baffles me (of 
> course this
> may be because I'm not a native speaker of English :).
> 
> > Anyway, you could automate a pack that says something 
> ridiculous, like
> > pack anything older then one thousand days.
> 
> I saw some references to the Zope scheduler..would this be the thing
> that I'd use to automate backups?

There really isn't a Zope Scheduler facility, unfortunately.  I'd expect
it to become more prominent when concurrency arrives.

Instead, use cron.  Write a little ZRPC (or just httplib) script that
connects to the Control Panel and executes a pack.
 
> I see. So the hack would be to write an ineffective pack 
> operation that
> runs every day (preferably before the external backup starts 
> but not too
> long before it starts..hmm), so that Data.bbb.old is created 
> (as a side
> effect).

Precisely.
 
> > Or possibly, none of the above will work and it's total hogwash. :^)
> 
> Before I start implementing the backup procedure I'd like some more
> washing of this hog, I think. An alternative strategy that 
> occured to me
> (for Zope 1.10.2, I think..I haven't installed that one yet) 
> would be to
> use file system export.

That's another option.  I'm not sure how much the import/export
machinery executes at the application level instead of the database
level (where pack resides), so export *might* be a tad slower.  Also it
won't *really* be a full backup as it won't contain old revisions of
objects.
 
> It would also be nice if this backup could somehow be 
> synchronized with
> the external tape backup procedure, so that the tape backup doesn't
> backup while Zope's still creating a backup, and such.

Uhh, I imagine that's one for you.
 
> I'm sure I'm not the only one trying to make a proper backup 
> of the Zope
> database. How is this done by other people?

We do backups all the time on Unix and have no problems.  The Zope
database format generally makes it pretty safe to do backups (as all
write operations are appends).

--Paul

Paul Everitt       Digital Creations
paul@digicool.com  540.371.6909