collective / pas.plugins.ldap

Zope (and Plone) PAS Plugin providing users and groups from LDAP directory
http://pypi.python.org/pypi/pas.plugins.ldap
Other
13 stars 20 forks source link

Document how how to enable memcached #103

Open NicolasGoeddel opened 4 years ago

NicolasGoeddel commented 4 years ago

Hi,

I do not understand how to activate the caching feature. I checked the checkbox at "Cache LDAP queries" and tried to set localhost as the "Memcached Server to use". I also installed memcached on our Ubuntu machine using apt install memcached. systemctl status memcached tells me that the service is running. What am I missing?

Unfortunately there is no documentation about the "How to enable memcached". It is only mentioned that it can be used.

The property field "Memcached Server to use" always has the value feature not available which does not help me either. How can I make that feature available? Do I need an extra python package to install? Or an extra extension for Plone?

I am running Plone 5.2.1 with Python 3.6.8.

This issue is also about updating the documentation about caching to help other users. Thank you.

jensens commented 4 years ago

Add one of the following memcached python client libs to your instances eggs section in your buildout:

I think this need to be added to the README.

NicolasGoeddel commented 4 years ago

Thank you. Which one do you prefer?

jensens commented 4 years ago

I prefer pylibmc. it is slightly faster, but needs the c-library installed in the system.

NicolasGoeddel commented 4 years ago

I installed pylibmc using buildout and I can import it successfully and store values in it from the command line when I connect manually to the memcached server. However the ldap control panel still shows "feature not available" and I also can not override that field. What am I doing wrong?

This was my test:

>>> import pylibmc
>>> mc = pylibmc.Client(["127.0.0.1"], binary = True, behaviors={'tcp_nodelay' : True, 'ketama' : True})
>>> mc['hi']
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/home/user/plone/buildout-cache/eggs/pylibmc-1.6.1-py3.6-linux-x86_64.egg/pylibmc/client.py", line 160, in __getitem__
    raise KeyError(key)
KeyError: 'hi'
>>> mc['hi'] = 'hello'
>>> mc['hi']
'hello'

I also tried an other invalid ip address as a counterexample and I got the right error:

pylibmc.Error: error 31 from memcached_set: (0x28a8610) A TIMEOUT OCCURRED, (number_of == 0),  host: 192.0.0.1:11211 -> libmemcached/connect.cc:133
NicolasGoeddel commented 4 years ago

Sorry for pushing this but I really could need a bit help as soon as possible. Thanks!

NicolasGoeddel commented 4 years ago

It seems that it works without issues on the production machine but not on our development machine. I will investigate that.

ldaverio commented 2 years ago

I installed pylibmc using buildout and I can import it successfully and store values in it from the command line when I connect manually to the memcached server. However the ldap control panel still shows "feature not available" and I also can not override that field. What am I doing wrong?

It seems to me that it's related to issue #34, I stumbled on the same problem for a couple of days before seeing the light. If you have deinstalled + reinstalled pas.plugins.ldap, you must apply the indicated workaround from the ZMI.

ldaverio commented 2 years ago

It seems that it works without issues on the production machine but not on our development machine. I will investigate that.

I would suppose you had deinstalled and reinstalled the module at some point on your development machine, but not on your production machine. Cf. my previous reply.