home contents changes options help subscribe edit (external edit)

ZEO (Zope Enterprise Objects) is a way of running a zope server in distributed fashion. Instead of one zope instance, you run a zeo server with one or more client instances in front of it. Even if you don't need this for scalability, it allows you to connect to and debug a running server which is extremely useful.

ZEO is actually a special type of database storage for ZODB (Zope Object Database) called ClientStorage. It allows transparent storage and retrieval of objects stored on a remote storage server. ZEO and ZODB (Zope Object Database) can both be used outside of Zope in standard Python programs.

See also [Zope Book Chapter 13: Scalability and ZEO]? (2.5 edition).

ZEO is now included with Zope 2.7, but the included ZEO setup docs are out of date. This page expands on Chris McDonough's notes.

With 2.7, ZEO setup has become really easy! You should make use of the debug prompt, it's a great tool for understanding problems. See Debugging for more, eg how to set up emacs, pdb and pdbtrack.el to get source-level debugging.

Setting up a ZEO server

This only works under UNIX at the moment:

     $ SOFTWARE_HOME/bin/mkzeoinstance.py
     Usage: mkzeoinstance.py home [port]
     $ SOFTWARE_HOME/bin/mkzeoinstance.py /zeo 9999
     Created directory /zeo
     Created directory /zeo/etc
     Created directory /zeo/var
     Created directory /zeo/log
     Created directory /zeo/bin
     Wrote file /zeo/etc/zeo.conf
     Wrote file /zeo/bin/zeoctl
     Changed mode for /zeo/bin/zeoctl to 755
     Wrote file /zeo/bin/runzeo
     Changed mode for /zeo/bin/runzeo to 755

You've created a ZEO server in /zeo. This looks much like an ordinary zope instance except you start it by invoking "/zeo/bin/zeoctl start", and it will then listen on port 9999 for client connections.

Note: Data.fs is kept in the ZEO server, all products are installed in the client.

ZEO can also be run in DaemonMode.

Setting up a ZEO client

Make a zope instance, eg:

     $ SOFTWARE_HOME/bin/mkzopeinstance.py -d /zope1 -u adminuser:adminpassword

You've created an ordinary Zope server in /zope1. To convert this to a ZEO client, edit /zope1/etc/zope.conf and exchange the zodb_main sections at the bottom, and configure the port (9999) in the ZEO client section. (Note: see other steps in [Configuring Zope 2.7]?) So it will look like this:

 #<zodb_db main>
 #    # Main FileStorage database
 #    <filestorage>
 #      path $INSTANCE/var/Data.fs
 #    </filestorage>
 #    mount-point /
 #</zodb_db>

 <zodb_db temporary>
 ...etc...

 # ZEO client storage:
 #
 <zodb_db main>
    mount-point /
    <zeoclient>
      server localhost:9999
      storage 1
      name zeostorage
      var $INSTANCE/var
    </zeoclient>
 </zodb_db>

Start the client in the usual way: "/zope1/bin/zopectl start". Now when you access the client's ZMI, you will see the contents of the zeo server's Data.fs.

Converting an existing Zope instance to ZEO

Let's assume you already have an instance in /zope1. First, make a backup in case of mistakes. Create your zeo server as above, but don't start it yet. Stop your instance if it's running. Move your /zope1/var/Data.fs to /zeo/var. Mind the owner, group and permissions of Data.fs stay the same when copying/moving it. Edit /zope1/etc/zope.conf as above. Start zeo and zope1.

Debugging a live server with ZEO

See DebuggingWithZEO.

Performance Tuning

read ZEOCache

Further resoures

Questions

What about products?

You don't need products on the ZEO server, only in the client instances (unless a product supports write conflict resolution, see below). The ZEO Server is simply serving the zodb database via tcp/ip. It has no knowledge about the objects stored in it and it doesn't need to. Again: Data.fs is only in /zeo/var, Products is only in /zope1.

The exception is write conflict resolution; when two requests in seperate threads try to alter the same object, and this object has a _p_resolveConflict method, this method is used to resolve the conflict instead of failing one request for Zope to retry. In order for ZEO to take advantage of this, it will need to be able to import the Product in question. You'll need to install any Product that uses write conflict resolution (grep for _p_resolveConflict) plus any dependencies, in the ZEO instance Products subdirectory.

Converting existing Zope: The Data.fs from my zope/var is now at zeo/var and in zope/var there is nothing. But why do we put in the zope/etc/zope.conf # ZEO client storage: < zodb_db main> ... var $INSTANCE/var , when in $INSTANCE/var there is nothing ?

Not yet answered

Do I have to start the zeo server first and then the client ?

No, start order doesn't matter.

Experience: My zeo is up and running and i did some debugging on 2nd zope. :) Unfortunately an eror occured: AttributeError?: __before_publishing_traverse__ ... maybe my Data.fs is broken?

...

How can the format of logfile be configured?

Unknown. Move to How to do logging in zope ?

If I'm running a zeo client for its debug prompt, is there any advantage to having debug-mode on ?

Not really.. only if you want instant reload of file-based templates while debugging.


comments:

No running --praveen_sunsetpoint, Fri, 23 May 2008 08:19:40 -0400 reply
Hi, I have started my client and server zope instance but when i open in browser with port 8180, i am not able to see default page



subject:
  ( 23 subscribers )