[Zope-ZEO] Thoughts on database initialization

Greg Ward gward@mems-exchange.org
Thu, 18 May 2000 11:01:18 -0400


Hi all --

We (Andrew Kuchling and I) been having some discussion on how a
ZODB/ZEO-based system should start up and initialize its connection to a
database.  Our system is probably going to have three main entry points:

  * web server
  * admin scripts (command-line tools run for various database
    maintenance tasks)
  * admin GUIs (when we need a richer interface than we can provide
    through the web; these will be mainly for internal use, but
    we might someday distribute them externally)

We'd like to retain the flexibility to select different storages for
each type of entry point at runtime: for example, for an admin script
that hammers the whole database ruthlessly, we might want to shut down
our ZEO server and run that script directly on the database with a
FileStorage, while other admin scripts might be perfectly happy to go
through a ClientStorage.

Right now we're leaning towards using an environment variable for this,
eg. after stopping the ZEO server:

  FOODB=file:/data/foo.fs hammer_db

or to connect to a different ZEO server from the default:

  FOODB=client:althost,1234 browse_db

or to try out a different storage:

  FOODB=berkeley:/data/foo.db time_db

Anyways, you get the idea: the environment variable consists of the
storage type and optional storage-specific data.  For filesystem
storages (file, berkeley), that data is just a filename; for
network-oriented storages (client, or a mythical RDBMS storage), the
data would probably be a (host, port) pair.

Of course, if the environment variable is not defined, we'd do the
Sensible Thing: open a client storage to our production ZEO server.
That way, internal users running a GUI client on (say) Windows wouldn't
have to muck with the environment variable: it'd just be a feature for
us Unix geek developers.

Does this sound like the right way to do it?  Anyone have
different/better ideas?

        Greg
-- 
Greg Ward - software developer                gward@mems-exchange.org
MEMS Exchange / CNRI                           voice: +1-703-262-5376
Reston, Virginia, USA                            fax: +1-703-262-5367