Sharing Session among multiple ZEO clients

Usually the session is stored inside a RAM based ZODB mount inside /temp_folder. This folder is only valid inside one single ZEO client. Other ZEO clients in scaled environments dont know of that session and therefore dont know about logged in users. The solution to this is to setup a RAM based ZODB mount on the ZEO server.

Patching Zope 2.7.0

To accomplish this with Zope 2.7.0 you need to apply this patch. This patch has been integrated into Zope 2.7.1 and later.

--- TemporaryStorage.py.orig    2004-05-18 19:42:07.000000000 +0200
+++ TemporaryStorage.py 2004-05-18 19:35:04.000000000 +0200
@@ -67,6 +67,10 @@
         self._last_cache_gc = 0
         self._oid = '\0\0\0\0\0\0\0\0'
                                                                                                                           
+    def lastTransaction(self):
+        """Return transaction id for last committed transaction"""
+        return self._ltid
+
     def __len__(self):
         return len(self._index)
                                                                                                                           
@@ -151,6 +155,8 @@
         index=self._index
         opickle=self._opickle
                                                                                                                           
+        self._ltid = tid
+
         # iterate over all the objects touched by/created within this
         # transaction
         for entry in self._tmp:

ZEO configuration (zeo.conf)

Add the following section to your zeo.conf.

%import tempstorage
<temporarystorage temp>
   name temporary storage for sessioning
</temporarystorage>

ZOPE configuration (zope.conf)

Add the following section to your zope.conf, by replacing the existing tempfolder section.

<zodb_db temporary>
    <zeoclient>
      server 8100
      storage temp
      name zeostorage
      var $INSTANCE/var
    </zeoclient>
    mount-point /temp_folder
    container-class Products.TemporaryFolder.TemporaryContainer
</zodb_db>

Copyright Simon Eisenmann http://longsleep.org/ - License under Creative Commons License - valid: xhtml, css

powered by icoya