• Contact Us
  • Home
  • Reference

Using slapindex

Discover how to effectively utilize slapindex for streamlined data management and improved indexing efficiency.

Written by Maryanne Normann

Updated at March 3rd, 2026

  • Quick Start
  • Installation
    Best Practices Configuration Troubleshooting Design Performance Platform
  • Maintenance
    Releases Upgrade
  • Reference
+ More

Table of Contents

Prerequisites Example (slapd.conf setup) Example (cn=config setup) Caution

Date: 11-04-2022

slapindex regenerates index files for back-mdb databases. You run it after:

  • adding or changing any index lines in slapd.conf or olcDbIndex values in cn=config, or
  • after serious DB corruption or data restore (e.g., from LDIF)

WARNING: Don’t run slapindex while slapd is online — LMDB will complain or corrupt data!

 

Prerequisites

You need exclusive access to the database files.

Stop slapd first unless you’re indexing a replica copy that’s offline:

 
systemctl stop slapd
# or
service slapd stop

Confirm your DB path (e.g. /var/lib/ldap or /opt/symas/var/openldap-data). That’s where the data.mdb and lock.mdb live.

Example (slapd.conf setup)

If you changed lines like this:

index cn eq,sub
index mail eq
index uid eq

Run:

slapindex -f /opt/symas/etc/openldap/slapd.conf -b "dc=example,dc=com"

Options:

Flag Meaning
-f Path to your slapd.conf
-b Base DN for the DB you want to reindex (only needed if multiple DBs)
-v Verbose (recommended)

If you omit -b, it indexes every DB defined in the config.

Example (cn=config setup)

If you’re using dynamic config (/opt/symas/etc/openldap/slapd.d), and you want to add indexes, use ldapmodify using an ldif file with the indexes you wish to add.

Here's a link to the ldapmodify knowledge base article: Using ldapmodify.

Here is an example of a .ldif file with new index attributes to add:

   dn: olcDatabase={1}mdb,cn=config
   changetype: modify
   add: olcDbIndex
   olcDbIndex: attrA eq
   -
   add: olcDbIndex
   olcDbIndex: attrB eq

Find the database directory.  Default for Symas OpenLDAP is: /opt/symas/var/openldap-data/

Run:

slapindex -F /opt/symas/etc/openldap/slapd.d -b "dc=example,dc=com" -v

The -v will run in Verbose mode, but this is not required.

Caution

-q (quick mode) skips value validation; omit it if you’re verifying attribute syntax changes

If you changed index definitions drastically, a slapcat → wipe DB → slapadd cycle is safest

For more information, please see slapindex Man Page.

 

 

Copyright © 2020-2024 Symas Corporation. All rights reserved.
slapindex utility cli

Was this article helpful?

Yes
No
Give feedback about this article

Related Articles

  • Chaining Overlay with Keep Alive Function
  • cn=monitor Reference
  • Common ldap Command Parameters
  • Common slapd Command Parameters
  • Convert Single-Master to Multi-Master Replication
  • Symas Blog RSS Feed
  • Symas on Facebook
  • Symas on Twitter
  • Symas Blog
  • Symas on LinkedIn
  • Symas YouTube Channel

Copyright © 2025, Symas Corporation. All rights reserved. Privacy Statement (updated July 31, 2023)

Phone:

Main Office: +1.650.963.7601
Fax: +1.650.390.6284

Email:

Sales: sales@symas.com
Support: support@symas.com

Office Hours:

8:00 AM - 5:00 PM ET

Office Location:

Symas Corporation
PO Box 391
Grand Junction, CO 81507 USA

Expand