配置Plone以将Relstorage用作blobstorage

时间:2014-12-17 13:54:21

标签: mysql plone plone-4.x blobstorage relstorage

我在一个网站上安装了Plone 4.3.3。首先,buildout配置为使用var / filestorage中的Data.fs文件和var / blobstorage中的共享blob存储。然后我在buildout中添加了一个Relstorage,并将Data.fs文件的内容转换为底层的MySQL数据库。现在Plone正在使用Relstorage而不是Data.fs。

但是现在我还想使用Relstorage而不是blobstorage。因为我对Plone而言比较新,特别是Relstorage的东西,我的想法是首先设置一个新的空Plone。然后我将buildout.cfg和base.cfg从第一个复制到新的。然后我创建了一个新的数据库userZodb并更改了base.cfg以使用新数据库,我还更改了zeoserver和clients的端口。下一步是重新配置relstorage而不使用基于文件的blobstorage。

rel-storage =
    type mysql
    db userZodb
    user zodbuser
    passwd innzop
    blob-dir ${buildout:var-dir}/blobstorage
    shared-blob-dir false

# shared blobs are much faster if we're on the same server.
# if not, turn it off.
shared-blob = off

然后我跑了扩建。一切都建成了。启动zeoserver后,我从客户端收到此错误:

user@server:~/Plone433-dev/zeocluster3$ ./bin/zeoserver start
. 
daemon process started, pid=35136
user@server:~/Plone433-dev/zeocluster3$ ./bin/client1 fg
2014-12-17 14:50:31 INFO ZServer HTTP server started at Wed Dec 17 14:50:31 2014
    Hostname: 0.0.0.0
    Port: 9180
2014-12-17 14:50:32 INFO Products.PloneFormGen gpg_subprocess initialized, using /usr/bin/gpg
Traceback (most recent call last):
  File "/home/user/Plone433-dev/zeocluster3/parts/client1/bin/interpreter", line 289, in <module>
    exec(compile(__file__f.read(), __file__, "exec"))
  File "/home/user/Plone433-dev/buildout-cache/eggs/Zope2-2.13.22-py2.7.egg/Zope2/Startup/run.py", line 76, in <module>
    run()
  File "/home/user/Plone433-dev/buildout-cache/eggs/Zope2-2.13.22-py2.7.egg/Zope2/Startup/run.py", line 22, in run
    starter.prepare()
  File "/home/user/Plone433-dev/buildout-cache/eggs/Zope2-2.13.22-py2.7.egg/Zope2/Startup/__init__.py", line 86, in prepare
    self.startZope()
  File "/home/user/Plone433-dev/buildout-cache/eggs/Zope2-2.13.22-py2.7.egg/Zope2/Startup/__init__.py", line 262, in startZope
    Zope2.startup()
  File "/home/user/Plone433-dev/buildout-cache/eggs/Zope2-2.13.22-py2.7.egg/Zope2/__init__.py", line 47, in startup
    _startup()
  File "/home/user/Plone433-dev/buildout-cache/eggs/Zope2-2.13.22-py2.7.egg/Zope2/App/startup.py", line 81, in startup
    DB = dbtab.getDatabase('/', is_root=1)
  File "/home/user/Plone433-dev/buildout-cache/eggs/Zope2-2.13.22-py2.7.egg/Zope2/Startup/datatypes.py", line 287, in getDatabase
    db = factory.open(name, self.databases)
  File "/home/user/Plone433-dev/buildout-cache/eggs/Zope2-2.13.22-py2.7.egg/Zope2/Startup/datatypes.py", line 185, in open
    DB = self.createDB(database_name, databases)
  File "/home/user/Plone433-dev/buildout-cache/eggs/Zope2-2.13.22-py2.7.egg/Zope2/Startup/datatypes.py", line 182, in createDB
    return ZODBDatabase.open(self, databases)
  File "/home/user/Plone433-dev/buildout-cache/eggs/ZODB3-3.10.5-py2.7-linux-x86_64.egg/ZODB/config.py", line 101, in open
    storage = section.storage.open()
  File "/home/user/Plone433-dev/buildout-cache/eggs/RelStorage-1.6.0b2-py2.7.egg/relstorage/config.py", line 33, in open
    return RelStorage(adapter, name=config.name, options=options)
  File "/home/user/Plone433-dev/buildout-cache/eggs/RelStorage-1.6.0b2-py2.7.egg/relstorage/storage.py", line 212, in __init__
    self.blobhelper = BlobHelper(options=options, adapter=adapter)
  File "/home/user/Plone433-dev/buildout-cache/eggs/RelStorage-1.6.0b2-py2.7.egg/relstorage/blobhelper.py", line 118, in __init__
    fshelper.create()
  File "/home/user/Plone433-dev/buildout-cache/eggs/ZODB3-3.10.5-py2.7-linux-x86_64.egg/ZODB/blob.py", line 359, in create
    (self.layout_name, self.base_dir, layout))
ValueError: Directory layout `zeocache` selected for blob directory /home/user/Plone433-dev/zeocluster3/var/blobstorage/, but marker found for layout `bushy`

不幸我不知道问题出在哪里。有人建议吗? 谢谢!

2 个答案:

答案 0 :(得分:0)

如果你正在使用relstorage,blob目录仍然用于缓存(Check for more infos)。在您的情况下,您的目录布局存在问题。

您可以删除$ {buildout:directory}中的洞var目录并重新运行buildout。 这将创建一个新的var目录。启动实例后,您应该有一个具有正确布局的新blob目录。

OR

您可以修改$ {buildout:directory} / var / blobstorage中的.layout文件,并将值从bushy更改为zeocache

说明:

第一次启动Plone实例时,它会使用给定的布局创建blobstorage目录 - 在您的情况下,它是默认的bushy。由于您更改了存储空间,因此需要zeocache。但标记文件.layout不会自动更改。

如果这没有帮助,请发布完整的buildout.cfg。

答案 1 :(得分:0)

解决方案是再次使用zodbconvert。正确配置它可以从一个存储转换为另一个存储,例如从Blobstorage到Relstorage。在我的情况下,配置看起来像:

<filestorage source>
  path     /home/user/Plone433-dev/zeocluster/var/filestorage/Data20141230.fs
  blob-dir /home/user/Plone433-dev/zeocluster/var/blobstorage
</filestorage>

<relstorage destination>
  shared-blob-dir false
  # ZODB Cache Dir
  blob-dir ./var/cacheblob
  blob-cache-size 10mb
  <mysql>
    host localhost
    db Zodb
    user zodbuser
    passwd XXXXXXXXX
  </mysql>
</relstorage>

之后,您必须更改base.cfg和buildout.cfg以仅使用relstorage。您可以在此处找到有关其运作方式的更多信息:https://www.techidiots.net/notes/plone-1/plone-4-3-3-relstorage