2012. május 14., hétfő

OpenLDAP Indexing on Ubuntu 12.04

In the previous post we have set up our nice LDAP-server. But in the syslog you can find some irritating lines:
<= bdb_equality_candidates: (uid) not indexed
Okay, lets do something about it.
(Ez a cikk magyarul is olvasható)
The thing is that slapd would like to avoid searching through the whole database, and wants to use an index instead. Setting up indexing is covered in most of HOWTOs and usually without any any clarification. Reading through the links in 'further reading' for me it seems to be clear that many HOWTOs are wrong when indexing the uid attribute by eq,pres,sub.
So I'll create a file called index_ldap.ldif:
dn: olcDatabase={1}hdb,cn=config
changetype: modify
replace: olcDbIndex
olcDbIndex: uid,uidNumber,gidNumber,memberUid,uniqueMember,objectClass,cn eq
Then:
sudo ldapmodify -Y EXTERNAL -H ldapi:/// -f index_ldap.ldif
The only thing left is to have the already exisiting stuff indexed. First we stop the server, then we do the indexing using the openldap user and when done we restart the server.
sudo service slapd stop
sudo su - openldap -c slapindex
sudo service slapd start
Cool. We're going to have some more posts on OpenLDAP.

Further reading:
http://www.openldap.org/doc/admin24/tuning.html
http://www.zytrax.com/books/ldap/apa/indeces.html
http://ilostmynotes.blogspot.com/2009/08/eliminating-openldap-uid-not-indexed.html

Nincsenek megjegyzések: