Issues adding images and files

I am connecting Plone on Server1 to a Data.fs file on Server2. Everything is working as it should except for when it comes to adding images and files. The blobstorage folder on Server2 is being accessed but I keep getting this error. It seems to want to find a .tmp file:

Traceback (innermost last):

Module ZPublisher.Publish, line 146, in publish
Module Zope2.App.startup, line 303, in commit
_Module transaction.manager, line 89, in commit
_Module transaction.transaction, line 329, in commit
_Module transaction._transaction, line 446, in commitResources
Module ZODB.Connection, line 781, in tpc_vote
Module ZEO.ClientStorage, line 1098, in tpc_vote
_Module ZEO.ClientStorage, line 929, in check_serials

IOError: [Errno 2] No such file or directory: '/var/plone/sharedservices/zeocluster/var/blobstorage/0x00/0x00/0x00/0x00/0x00/0x00/0xbf/0xf5/0x00RdyDrN.tmp-'

I have set up my buildout according to this:
https://community.plone.org/t/connecting-to-a-data-fs-file-on-another-server-solved/3710/12:

Server 2
[zeoserver]
zeo-address = 0.0.0.0:8100

Once the above was done, I did the following:
$ sudo -u plone bin/buildout
$ sudo -u plone bin/zeoserver start

Server 1
buildout.cfg:
[zeoserver]
zeo-address = server2-ip:8100

$ sudo -u plone bin/buildout
$ sudo -u plone bin/plonectl start

Any advise would be most appreciated. Thank you.

I would strongly recommend using sshfs if you are on an OS platform that has packages to support it. This is what I use to mount blobstorage from another server.

Sean

1 Like

seanupton, thank you so much. I will make a note of that.

Since this is a fairly new site and in trying to isolate the problem, instead of copying the blobstorage file from one server to another I deleted my server2 blobstorage folder and reran the buildout on server2. It created a new one for me. My Plone is now talking to the correct blobstorage file but I am still getting missing tmp file issues.

Curious.. how's sshfs in terms of performance for you? Is there any observable lag?

in the past I had bad experiences using file systems like NFS and GlusterFS on sites with millions of blobs, specially when packing the ZODB; IMO, there's no need for such additional layers.

having said that, you don't need anything besides ZEO to have your blobs available on both servers:

  • the clients running on the server hosting the ZEO server should use shared-blob = on
  • the clients running on the remote server should use the default shared-blob = off

pay special attention also to the blob-storage directive.

the following is from plone.recipe.zope2instance documentation:

blob-storage
The location of the blob zeocache, defaults to var/blobcache. If shared-blob is on it defaults to ${buildout:directory}/var/blobstorage.

shared-blob
Defaults to off. Set this to on if the ZEO server and the instance have access to the same directory. Either by being on the same physical machine or by virtue of a network file system like NFS. Make sure this instances blob-storage is set to the same directory used for the ZEO servers blob-storage. In this case the instance will not stream the blob file through the ZEO connection, but just send the information of the file location to the ZEO server, resulting in faster execution and less memory overhead.

so, resuming: when shared-blob = off the instance will request the blob to the ZEO server and store it in var/blobcache so it don't have to request it again next time.

IIRC, var/blobcache size is kept to a percentage of the total size (or free size, I don't remember right now) of your disk drive.

less moving parts is always better.

hvelarde, thank you so much. This is what I did:

Server1 buildout.cfg:
[zeoserver]
<= zeoserver_base
recipe = plone.recipe.zeoserver
zeo-address = Server2-IPAddress:9100

[client1]
<= client_base
recipe = plone.recipe.zope2instance
zeo-address = ${zeoserver:zeo-address}
http-address = 9000
shared-blob = off

[client2]
<= client_base
recipe = plone.recipe.zope2instance
zeo-address = ${zeoserver:zeo-address}
http-address = 9001
shared-blob = off

I reran buildout and tried to start a client but the following errors appeared:
2017-04-05 11:13:10 INFO ZEO.ClientStorage zeostorage ClientStorage (pid=3358) created RW/normal for storage: '1'
Traceback (most recent call last):
File "/var/plone/training/zeocluster/parts/client1/bin/interpreter", line 281, in <module>
exec(compile(__file__f.read(), __file__, "exec"))
File "/var/plone/training/buildout-cache/eggs/Zope2-2.13.26-py2.7.egg/Zope2/Startup/run.py", line 76, in <module>
run()
File "/var/plone/training/buildout-cache/eggs/Zope2-2.13.26-py2.7.egg/Zope2/Startup/run.py", line 22, in run
starter.prepare()
File "/var/plone/training/buildout-cache/eggs/Zope2-2.13.26-py2.7.egg/Zope2/Startup/__init__.py", line 92, in prepare
self.startZope()
File "/var/plone/training/buildout-cache/eggs/Zope2-2.13.26-py2.7.egg/Zope2/Startup/__init__.py", line 268, in startZope
Zope2.startup()
File "/var/plone/training/buildout-cache/eggs/Zope2-2.13.26-py2.7.egg/Zope2/__init__.py", line 47, in startup
_startup()
File "/var/plone/training/buildout-cache/eggs/Zope2-2.13.26-py2.7.egg/Zope2/App/startup.py", line 83, in startup
DB = dbtab.getDatabase('/', is_root=1)
File "/var/plone/training/buildout-cache/eggs/Zope2-2.13.26-py2.7.egg/Zope2/Startup/datatypes.py", line 287, in getDatabase
db = factory.open(name, self.databases)
File "/var/plone/training/buildout-cache/eggs/Zope2-2.13.26-py2.7.egg/Zope2/Startup/datatypes.py", line 185, in open
DB = self.createDB(database_name, databases)
File "/var/plone/training/buildout-cache/eggs/Zope2-2.13.26-py2.7.egg/Zope2/Startup/datatypes.py", line 182, in createDB
return ZODBDatabase.open(self, databases)
File "/var/plone/training/buildout-cache/eggs/ZODB3-3.10.7-py2.7-linux-x86_64.egg/ZODB/config.py", line 101, in open
storage = section.storage.open()
File "/var/plone/training/buildout-cache/eggs/ZODB3-3.10.7-py2.7-linux-x86_64.egg/ZODB/config.py", line 220, in open
**options)
File "/var/plone/training/buildout-cache/eggs/ZODB3-3.10.7-py2.7-linux-x86_64.egg/ZEO/ClientStorage.py", line 393, in __init__
self.fshelper.create()
File "/var/plone/training/buildout-cache/eggs/ZODB3-3.10.7-py2.7-linux-x86_64.egg/ZODB/blob.py", line 359, in create
(self.layout_name, self.base_dir, layout))
ValueError: Directory layoutzeocacheselected for blob directory /var/plone/training/zeocluster/var/blobstorage/, but marker found for layout 'bushy'

Checking my files:
Server2 var/blobstorage/.layout:
bushy

Server1 parts/client1/etc/zope.conf and parts/client2/etc/zope.conf:
<zodb_db main>
# Main database
cache-size 30000
# Blob-enabled ZEOStorage database
<zeoclient>
read-only false
read-only-fallback false
blob-dir /var/plone/training/zeocluster/var/blobstorage
shared-blob-dir off
server Server2-IPAddress:9100
storage 1
name zeostorage
var /var/plone/training/zeocluster/parts/client1/var
cache-size 128MB
</zeoclient>
mount-point /
</zodb_db>

Am I missing something. Any advise would be most appreciated. Thank you.

that's your problem; var/blobstorage and var/blobcache are different things and use a different layout; seems you're inheriting the value from other part of your buildout configuration.

Thanks hvelarde. Except for shared-blob=off, nothing has been added to the original buildout from the Plone installer. Based on your advice, I added this extra line blob-storage = ${:var}/blobcache

So my buildout.cfg now is:
[client1]
<= client_base
recipe = plone.recipe.zope2instance
zeo-address = ${zeoserver:zeo-address}
http-address = 9000
shared-blob = off
blob-storage = ${:var}/blobcache

[client2]
<= client_base
recipe = plone.recipe.zope2instance
zeo-address = ${zeoserver:zeo-address}
http-address = 9001
shared-blob = off
blob-storage = ${:var}/blobcache

It is working perfectly now! The errors are gone and I can now add files and images without any issues. I hope this is the correct way of doing it. If there is a better way, please let me know.

Thank you again for all your help hvelarde. Cheers!

1 Like

hvelrade, I noticed that the blobcache is on server1. How to I get this blobcache file to reside on server2, which is where my Data.fs file is? I need to get all my data including files and images stored on server2.

you don't need that; as I said above: blobcache is only useful on servers that do not sharere the blobstorage in any way.

So would this meet my company's security requirement that all data be stored on a server specifically only for data, which in this case is Server2?

Two further questions:

  1. If I needed to restore my Plone's database, do I need to just restore Data.fs on Server2 and need not have to worry about the blobcache on Server1?
  2. Does the blobcache on Server1 contain my files and images? If so, it cannot reside on Server1. This is my predicament at the moment. Everything pertaining to data needs to be on Server2.

Any advice would be most appreciated. Thank you.

at this moment I'm a little bit confused about the names server 1 and server 2; I will call them ZEO server and ZEO client.

the Plone database will always reside on the ZEO server; the Plone database (ZODB) is located in the var/filestorage and var/blobstorage directories.

the blobcache directory in the ZEO client deployment is just a cache; you can remove the contents from there whenever you want and the instances will populated it again whenever they need an object from the blobstorage.

I don't know if the current situation meets with your company requirements, but if your requirements are so strict I suggest you to use a ZEO server with more memory to be able to allocate more clients there and forget about the second server, the ZEO client.

hvelarde, thanks for the explanation. Based on your explanation, server1 is my ZEO client and server2 is my ZEO server. Unfortunately, I cannot put my ZEO clients and the ZEO server together. My ZEO server would actually have the web server turned off. So I do need the client and the database on totally different servers.

When I used the default blobstorage configuration I could write to the database on my ZEO server but I could not upload files and images. I would have thought that my blobstorage would work in sync with Data.fs:

Server 2 (ZEO Server)
[zeoserver]
zeo-address = 0.0.0.0:8100

Once the above was done, I did the following:
$ sudo -u plone bin/buildout
$ sudo -u plone bin/zeoserver start

Server 1 (ZEO Client)
buildout.cfg:
[zeoserver]
zeo-address = server2-ip:8100

$ sudo -u plone bin/buildout
$ sudo -u plone bin/plonectl start

The inability to upload my files and images using the standard setup was what led to this whole exchange.

So, any advise would be most appreciated. The bottom line is that all my data needs to be on Server2 where the ZEO server resides. I hope this makes sense.

sorry, AFAIK your requirement can't be fulfilled with ZEO clients in different machines.