How do I reindex the LDAP database

From Mithiwiki
Jump to: navigation, search
MithiWiki Home > ConnectXf Home > ConnectXf Administration > Configuration > How do I reindex the LDAP database

HowTo Icon.png
How To
Product ConnectXf
Version All
Applies to Administrators
Level Advanced

How do I reindex the LDAP database

Indexing vastly improves search time but at the same time it increases the amount of time required to add/modify an entry.


  • If write performance is critical, you can index only the most commonly searched attributes.If your directory is strongly biased towards reads, you may index most of the attributes.


  • Below steps are for standalone server. In case of master-slave, perform below steps on the Master. Then take ldap backup of master & restore on slaves. The links for ldap backup and slave are

Using the Command Line Interface

  • Sign in as the root user to your server.
  • Make sure that /mcsdata has atleast 6 gb free.
  • Backup file /mithi/mcs/components/mithi-ldap-openldap/conf/server/ldap_indexes
   cp /mithi/mcs/components/mithi-ldap-openldap/conf/server/ldap_indexes /mithi/mcs/components/mithi-ldap-openldap/conf/server/
  • Edit file /mithi/mcs/components/mithi-ldap-openldap/conf/server/ldap_indexes
  • Add following lines at the end of the file if not already present : ( attributes might vary )
   index memberid eq
   index mithiParentName eq
  • Save file and exit
  • Stop ldap, smtp, pop, queue, imap services.
  • cd /var/lib/ldap
  • Take backup of mithiconnect folder
   cp -rp mithiconnect
  • Add a temporary tuning :
   echo "set_lk_max_locks 3000" >>mithiconnect/DB_CONFIG
  • Run slapdindex command
   /mithi/mcs/bin/ "/usr/local/openldap/sbin/slapindex -v -f /etc/openldap/slapd.conf -b dc=connectserver"
  • There will be output on screen until the process finishes.
  • After the process finishes, check disk space - atleast 2 gb should be free on /mcsdata.
  • du -sh /var/lib/ldap/mithiconnect

The size of this folder should not be more than 3.5 gb.

  • Check the /var/log/mithi/mcs/ using commmand
   /mithi/mcs/bin/ /var/log/mithi/mcs/ | more
   The output should not contain errors.
   Example errors are :
   indexing id=0003f62bdb(dc=connectserver): Lock table is out of available locks
   => bdb_idl_insert_key: c_put id failed: Cannot allocate memory (12)
   => bdb_tool_entry_reindex: txn_aborted! Accessing a corrupted shared library (80)
  • Remove the temporary tuning :
   vi mithiconnect/DB_CONFIG
   Remove line : set_lk_max_locks 3000
  • Start ldap, smtp, pop, queue, imap services.
  • Test working of services like smtp, pop, queue and imap.


If there is any problem :

  • Stop ldap if it is running.
  • cd /var/lib/ldap/
  • mv mithiconnect
  • mv mithiconnect
  • cp /mithi/mcs/components/mithi-ldap-openldap/conf/server/ /mithi/mcs/components/mithi-ldap-openldap/conf/server/ldap_indexes
  • Start ldap
  • Test working of services like smtp, pop, queue and imap.