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.

Note:

  • 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.

Note:

  • 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
http://xf.wiki.mithi.com/index.php/Administration:Change_the_Directory_Server#Take_a_backup_of_the_LDAP_database_from_the_Old_Directory_Server
http://xf.wiki.mithi.com/index.php/Administration:Change_the_Directory_Server#Restore_the_LDAP_database_on_the_New_Directory_Server


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/ldap_indexes.org
   
  • 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 mithiconnect.befindex.7jul.org
  • Add a temporary tuning :
   echo "set_lk_max_locks 3000" >>mithiconnect/DB_CONFIG
  • Run slapdindex command
   /mithi/mcs/bin/runonce.sh "/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/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.

Rollback

If there is any problem :

  • 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.