
In the previous setup, we had multiple database taken care by a single ZEO server. For this setup, we can have separate ZEO servers to take care of each database file. For that we will need to create another ZEO instance with a different socket-connection address (ip-address:port) And we may then reconfigure the zeo.conf files and zope.conf as follows:
Let us say first ZEO server caters the 1st database and the second ZEO server deals with the 2nd database.
a. Configure the first zeo.conf
The difference is in the file storage section. We need a filestorage section to include the first database. The rest of the configurations are default.
<zeo>
address 8800
# when we run the zeo servers in different machine,
#its good practice to keep the port id same for all zeo servers
read-only false
invalidation-queue-size 100
# pid-filename $INSTANCE/var/ZEO.pid
# monitor-address PORT
# transaction-timeout SECONDS
</zeo>
<filestorage 1>
path $INSTANCE/var/Data1.fs
</filestorage>
b. Configure the second zeo.conf
As we said this ZEO server will handle the 2nd database file.
<zeo>
address 8900
# when we run the zeo servers in different machine,
#its good practice to keep the port id same for all zeo servers
read-only false
invalidation-queue-size 100
# pid-filename $INSTANCE/var/ZEO.pid
# monitor-address PORT
# transaction-timeout SECONDS
</zeo>
<filestorage 2>
path $INSTANCE/var/Data2.fs
</filestorage 2>
c. Configure the zope.conf
So now all we need to do is make a few changes to the zope.conf to get access to the database via the ZEO servers.
<zodb 1>
<zeoclient>
server localhost:8800
storage 1
# ZEO client cache, in bytes
cache-size 20MB
# Uncomment to have a persistent disk cache
#client zeo1
</zeoclient>
</zodb>
<zodb 2>
<zeoclient>
server localhost:8900
storage 2
# ZEO client cache, in bytes
cache-size 20MB
# Uncomment to have a persistent disk cache
#client zeo2
</zeoclient>
</zodb>
And we don’t have to make any change to the code to change to this setup too.
The real advantage of zeo can be experienced when we use it with multiple zope instances.
Later we will see how to setup multiple zope instances sharing multiple database.
0 Responses to “One Zope instance with multiple ZEO servers”