Problem: LDAP index rebuild appears ineffective on a Backup Directory Node

Problem

LDAP searches return different results on the Primary and a Backup Directory Node. Existing objects may not be found on the Backup, or searches remain slow even after running slapindex.

A remaining /etc/ldap/slapd.d/cn=config.ldif can cause slapindex, when called without an explicit configuration file, to use a different database configuration instead of /etc/ldap/slapd.conf. Rebuilding those indexes does not repair the indexes used by the UCS LDAP server.

Investigation

Check whether the alternative configuration is still present:

ls -l /etc/ldap/slapd.d/cn=config.ldif

If present, slapindex without -f may use this configuration instead of the UCS configuration.

Solution

Run as root on the affected Backup. Ensure a current LDAP backup exists. LDAP will be unavailable on this server during the rebuild.

Stop LDAP and disable the unintended configuration. Do not overwrite an existing .DISABLED file:

systemctl stop slapd.service
mv -i /etc/ldap/slapd.d/cn=config.ldif \
      /etc/ldap/slapd.d/cn=config.ldif.DISABLED

Rebuild the domain database indexes using the UCS configuration explicitly:

slapindex -f /etc/ldap/slapd.conf -b "$(ucr get ldap/base)"

Using -f /etc/ldap/slapd.conf also selects the correct configuration without renaming the file.

After the rebuild completes successfully, start LDAP:

systemctl start slapd.service

Repeat the previously failing search locally on both servers. For example:

univention-ldapsearch -LLL '(uid=testuser)' dn source

Replace testuser with an affected account. Confirm that both servers return the expected object and search performance has recovered.