如何配置 OpenLDAP 代理/缓存来缓存所有查询
好的,这是一个 OpenLDAP 新手问题,所以请耐心等待。我无法在网络上找到直接答案,所以我们开始:
注意:最终目标是将 OpenLDAP 服务器设置为“单个”的代理/缓存查询以获取主 LDAP 中的所有结果(如果您熟悉 .Net 的 DirectoryServices dll,该应用程序只是在 LDAP 上进行 FindAll() 调用)。
我已经达到了代理/缓存显示与主服务器相同的结果(即它代理查询)的程度,但它似乎没有缓存。我这么说有两个原因:
- 如果我对主 LDAP 中的条目进行更新,我会立即在代理中看到更新的值(使用指向代理 URL 的 LDAP 浏览器),甚至在 TTL 过期之前也是如此。
- 如果我关闭主 LDAP 并对代理进行查询,则会出现连接异常。如果我没记错的话,我应该获得缓存的结果(同样,TTL 尚未过期)。
这是我用于代理/缓存的 OpenLDAP 配置文件(在 Windows 上,OpenLDAP v.2.4.23):
数据库 ldap
uri“ldap://MyPC”
后缀“dc=local”
rootdn“dc=local”
覆盖pcache
代理缓存 bdb 1000 3 250 432000
目录./cache
索引对象类eq
索引 cn eq,sub
代理缓存查询 100
proxyattrset 0 cn 证书撤销列表
代理模板(objectclass=)0 600
一些值得注意的事情:
- 我将主 LDAP 中的条目中的“所有”属性作为 proxyattrset 的一部分包括在内。我知道这对于缓存/服务预期查询是必要的。因为我想缓存 FindAll() 我认为这是实现它的方法。
- 一致性检查间隔设置为 5 天(432000 秒)。我希望缓存能够提供缓存的查询,即使主服务器已经关闭了那么长时间。另请注意,TTL 设置为 10 分钟(600 秒) - 这是因为我希望至少每 10 分钟刷新一次缓存查询(如果主服务器已启动)。
好的,关于我的问题:
- 有没有一种方法可以快速配置 OpenLDAP 来缓存所有查询,而不必指定 proxyattrset 中的所有属性?
- 当我终止主 LDAP 并对 TTL 内的代理进行查询时,为什么会出现连接错误?我的查询没有被缓存吗?如果是这样,我在配置文件中缺少什么来启用缓存?
Ok, this is an OpenLDAP newby question so bear with me. I haven't been able to find a straight answer on the webinets, so here we go:
Note: The ultimate goal is to have an OpenLDAP server set up as a proxy/cache for a "single" query to get all of the results in a master LDAP (if you're familiar with .Net's DirectoryServices dll, the app is just making a FindAll() call on the LDAP).
I have it to the point where the Proxy/Cache is showing the same results as the master (i.e., it is proxying the queries), however it doesn't seem to be caching. I say that because of 2 reasons:
- If I make an update to an entry in the master LDAP, I immediately see the updated value in the proxy (using an LDAP browser that's pointed to the proxy URL), even before the TTL has expired.
- If I shut down the master LDAP and make a query to the proxy, I get a connection exception. If I'm not mistaken, I should instead get a cached result (once again, the TTL hasn't expired).
Here's the OpenLDAP config file I'm using for the proxy/cache (on Windows, OpenLDAP v.2.4.23):
database ldap
uri "ldap://MyPC"
suffix "dc=local"
rootdn "dc=local"
overlay pcache
proxycache bdb 1000 3 250 432000
directory ./cache
index objectclass eq
index cn eq,sub
proxycachequeries 100
proxyattrset 0 cn certificateRevocationList
proxytemplate (objectclass=) 0 600
A few things worth noting:
- I am including "all" of the attributes in the entries in the master LDAP as part of the proxyattrset. I understand this is necessary for an intended query to be cached/serviced. Since I'm wanted to cache a FindAll() I assume this is the way to do it.
- The consistency check interval is set to 5 days (432000 secs). I want the cache to be able to serve cached queries even when the master server has been down for that long. Also note that the TTL is set to 10 mins (600 secs) - this is because I want the cache queries to be refreshed at least every 10 mins (if the master server is up).
Ok, on to my questions:
- Is there a way to quickly configure OpenLDAP to cache ALL queries without having to specify all the attributes in proxyattrset?
- Why am I getting a connection error when I kill the master LDAP and I make a query to the proxy within the TTL? Are my queries not being cached? If so, what am I missing in the config file to enable caching?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论