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 index/reindex the LDAP database

LDAP indexing is required to add/modify an index in ldap. Reindexing is required in case of corruption of indices.

  • 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.
  • Stop ldap, smtp, pop, queue, imap services.
  • cd /var/lib/ldap
  • Take backup of mithiconnect folder
   cp -rp mithiconnect mithiconnect.befindex.7jul.org
  • Add a temporary tuning :
   echo "set_lk_max_locks 3000" >>mithiconnect/DB_CONFIG
  • Copy script reindexLDAP.sh to /root/ of the server
  • Run dos2unix /root/reindexLDAP.sh
  • Give executable permissions : chmod +x reindexLDAP.sh
  • Run slapindex command via reindexLDAP.sh script
   /mithi/mcs/bin/runonce.sh "/root/reindexLDAP.sh"
  • 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 return code of slapindex :
cat /var/log/mithi/mcs/runonce.sh.log | grep "LDAP indexing finished with return code"
  • Check the /var/log/mithi/mcs/runonce.sh.log using commmand
   /mithi/mcs/bin/generatelogreport.sh /var/log/mithi/mcs/runonce.sh.log | 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 in running slapindex command, we can rollback to earlier status :

NOTE : If the ldap service is started after indexing and end users have used the server, then new data may be present in ldap and it will be lost because of below rollback steps.

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