Restoring ldap fails
Restoring LDAP fails
Trying to restore ldap with zmslapadd terminates with the following error:
$ /opt/zimbra/libexec/zmslapadd /tmp/ldap.bak /opt/zimbra/libexec/zmslapadd: line 17: ulimit: core file size: cannot modify limit: Operation not permitted 555c9803 => mdb_tool_next_id: dn2id_add failed: MDB_MAP_FULL: Environment mapsize limit reached (-30792) 555c9803 => mdb_tool_entry_put: txn_aborted! MDB_MAP_FULL: Environment mapsize limit reached (-30792) slapadd: could not add entry dn="cn=lpn-prd-mstr034.prosodie,cn=servers,cn=zimbra" (line=9786): txn_aborted! MDB_MAP_FULL: Environment mapsize limit reached (-30792) _ 0.01% eta 09m26s elapsed none spd 13.4 M/s Closing DB...
To fix the issue we need to set the ldap_db_maxsize attribute to its default setting:
zmlocalconfig -e ldap_db_maxsize=85899345920
After changing the attribute repeat the operations from the beginning.
Over time, depending on write activity, which is unique to every client, the MDB database will suffer from fragmentation. During the write process, mdb tries to reuse locations that were previously freed by delete activity. Essentially, a write can come in, that is just a "wrong" size. In this case MDB tries repeatedly to find an open slot in the approximately 4 million empty slots currently available in the database. This causes slapd to block write requests. The fix for this issue is to dump the LDAP database and reload it.
To accomplish that, as the zimbra user:
ldap stop /opt/zimbra/libexec/zmslapcat /tmp (or other good location) cd /opt/zimbra/data/ldap mv mdb mdb.backup mkdir -p mdb/db cd ~ /opt/zimbra/libexec/zmslapadd /tmp/ldap.bak ldap start