Reputation: 13610
I have a site where every time I try to open the database while the server was running, it displays an error that the database is already open by a different process.
The problem is that I have some scripts that could be scheduled with cron to check the database, or even just using pshell
while the server is running.
As of now, it seems impossible to open the database from different processes, while the doc actually says that it's possible to have multiple connections to the database.
This issue forces me to run just one script/process at a time, including the server.
Upvotes: 3
Views: 775
Reputation: 1124718
ZODB, in its default configation, is an in-process object database. You can, however, use a client-server model to share it across processes.
You have 3 options here:
Upvotes: 5
Reputation: 131
You can use RelStorage.
pip install RelStorage
... or add to setup.py requires:
requires = [
...
RelStorage',
]
Change developer.ini in section [app:main]:
[app:main]
...
zodbconn.uri = zconfig://%(here)s/relstorage.conf
Create a file 'relstorage.conf' with this content:
%import relstorage
<zodb main>
<relstorage>
<postgresql>
# The dsn is optional, as are each of the parameters in the dsn.
dsn dbname='zodb' user='zodbuser' host='yourhostname.net' password='YOURpassowrd'
</postgresql>
</relstorage>
</zodb>
According settings the 'relstorage.conf' must placed in same folder with 'developer.ini'
Upvotes: 0