zc.lockfile.LockError in ZODB

前端 未结 2 640
攒了一身酷
攒了一身酷 2021-01-19 19:15

I am trying to use ZODB 3.10.2 on my web server which is running Debian and Python 2.7.1. It seems like every time I try to access the same database from 2 different process

2条回答
  •  既然无缘
    2021-01-19 20:02

    The ZODB does not support multi-process access. This is why you get the lock error; the ZODB file storage has been locked by one process to prevent other processes altering it.

    There are several ways around this. The easiest option is to use ZEO. ZEO extends the ZODB machinery to provide access to objects over a network, and you can easily configure your ZODB to access a ZEO server instead of a local FileStorage file:

    
        
        server localhost:9100
        
    
    

    Another option is to use RelStorage, which stores the ZODB data in a relational database. RelStorage supports PostgreSQL, Oracle and MySQL backends. RelStorage takes care of concurrent access from different ZODB clients. Here is an example configuration:

    
      
        
          # The dsn is optional, as are each of the parameters in the dsn.
          dsn dbname='zodb' user='username' host='localhost' password='pass'
        
      
    
    

    RelStorage requires more up-front setup work but can outperform ZEO in many scenarios.

提交回复
热议问题