(Answer) (Category) OpenLDAP Faq-O-Matic : (Category) OpenLDAP Software FAQ : (Category) Configuration : (Category) SLAPD Configuration : (Category) Backends : (Category) The BDB/HDB backend (How do I setup/configure back-bdb/back-hdb?) : (Answer) How do I configure the BDB backend?
The BDB backend ("back-bdb") uses a lot of special features of Sleepycat's Oracle's Berkeley DB library, and there are a lot of details that must be set correctly to get the best results from it. Even though the LDBM backend ("back-ldbm") can use the BerkeleyDB library, the BDB and LDBM backends have some very important differences, as already noted in (Xref) What are the different backends? What are their differences?.

Because back-bdb is transaction-based and uses write-ahead logging to ensure data consistency, it has much heavier I/O demands than back-ldbm. Also, the transaction log files accumulate as data is written to the directory, and these log files must be cleaned out periodically. Otherwise the log files will consume enormous amounts of disk space. The cleanup procedures are described in (Xref) How to maintain Berkeley DB (logs etc.) ?.

The information needed to fully understand things and to properly configure back-bdb is divided among the slapd-bdb(5) manual page and the Oracle BerkeleyDB documentation (http://www.oracle.com/technology/documentation/berkeley-db/db/index.html).

You should read the entire slapd-bdb(5) manpage before proceeding. The only mandatory keyword is "directory" for setting the location of the database files. The other keywords control tradeoffs between data reliability, performance, and memory use. To ensure that committed transactions actually get flushed to disk, you should use the "checkpoint" keyword, otherwise your data is vulnerable to loss due to system failures. See the BerkeleyDB documentation for more information about checkpoints. (In fact, you should read all of chapter 9 "Berkeley DB Transactional Data Store Applications" in the BerkeleyDB reference manual. At least, read sections 1-3 and 13-24.)

The "dbnosync" keyword is provided for compatibility with back-ldbm; the preferred method of setting this is to use the BDB DB_CONFIG file option set_flags DB_TXN_NOSYNC. The "lockdetect" keyword is also deprecated, you should instead use the BDB DB_CONFIG file set_lk_detect keyword. (It's safe to leave this at the default setting.)

A number of important items must be configured in the BDB DB_CONFIG file and not in slapd.conf. You should, at least, read about these items:

set_cachesize
The BDB library maintains its own cache separate from the back-bdb entry cache. You must set this cache to a size appropriate for your database and physical memory size. Note that this is a persistent setting - after you set it the first time, further changes will be ignored until you recreate the environment using db_recover.
set_lg_dir
Set the directory for storing transaction logs. For best performance, the transaction logs must be located on a different physical disk from the database files.
set_lg_bsize
Set the buffer size for the transaction log. Larger is better, but it doesn't have much effect unless you're also using the DB_TXN_NOSYNC option. With a default log file size of 10MB I usually set this to 2MB. The default is only 32K, which is too small for back-bdb.
On a very busy system you might see error messages talking about running out of locks, lockers, or lock objects. Usually the default values are plenty, and in older versions of the BDB library the errors were more likely due to library bugs than actual system load. However, it is possible that you have actually run out of lock resources due to heavy system usage. If this happens, you should read about Configuring Locking and the set_lk_max_lockers, set_lk_max_locks, and set_lk_max_objects keywords.
See also: (Xref) What are the DB_CONFIG configuration directives? (Xref) Why isn't all of this essential Sleepycat's BerkeleyDB documentation integrated directly into OpenLDAP's documentation?
[Append to This Answer]
Previous: (Answer) How do I setup the BDB backend?
Next: (Answer) What are the DB_CONFIG configuration directives?
This document is: http://www.openldap.org/faq/index.cgi?file=893
[Search] [Appearance]
This is a Faq-O-Matic 2.721.test.
© Copyright 1998-2013, OpenLDAP Foundation, info@OpenLDAP.org