]> git.sur5r.net Git - openldap/blob - doc/man/man5/slapd-bdb.5
ITS#6904 Update to reflect that hdb is preferred
[openldap] / doc / man / man5 / slapd-bdb.5
1 .TH SLAPD-BDB 5 "RELEASEDATE" "OpenLDAP LDVERSION"
2 .\" Copyright 1998-2011 The OpenLDAP Foundation All Rights Reserved.
3 .\" Copying restrictions apply.  See COPYRIGHT/LICENSE.
4 .\" $OpenLDAP$
5 .SH NAME
6 slapd\-bdb, slapd\-hdb \- Berkeley DB backends to slapd
7 .SH SYNOPSIS
8 .B ETCDIR/slapd.conf
9 .SH DESCRIPTION
10 The \fBbdb\fP backend to
11 .BR slapd (8)
12 uses the Oracle Berkeley DB (BDB) package to store data.
13 It makes extensive use of indexing and caching to speed data access.
14 .LP
15 \fBhdb\fP is the recommended primary database backend.  It is a variant of
16 the \fBbdb\fP backend that uses a hierarchical database layout which
17 supports subtree renames. It is both more space-efficient and more
18 execution-efficient than the \fBbdb\fP backend.  It is otherwise identical
19 to the \fBbdb\fP behavior, and all the same configuration options apply.
20 .LP
21 It is noted that these options are intended to complement
22 Berkeley DB configuration options set in the environment's
23 .B DB_CONFIG
24 file.  See Berkeley DB documentation for details on
25 .B DB_CONFIG
26 configuration options.
27 Where there is overlap, settings in
28 .B DB_CONFIG
29 take precedence.
30 .SH CONFIGURATION
31 These
32 .B slapd.conf
33 options apply to the \fBbdb\fP and \fBhdb\fP backend database.
34 That is, they must follow a "database bdb" or "database hdb" line and
35 come before any subsequent "backend" or "database" lines.
36 Other database options are described in the
37 .BR slapd.conf (5)
38 manual page.
39 .TP
40 .BI cachesize \ <integer>
41 Specify the size in entries of the in-memory entry cache maintained 
42 by the \fBbdb\fP or \fBhdb\fP backend database instance.
43 The default is 1000 entries.
44 .TP
45 .BI cachefree \ <integer>
46 Specify the number of entries to free from the entry cache when the
47 cache reaches the \fBcachesize\fP limit.
48 The default is 1 entry.
49 .TP
50 .BI checkpoint \ <kbyte>\ <min>
51 Specify the frequency for checkpointing the database transaction log.
52 A checkpoint operation flushes the database buffers to disk and writes
53 a checkpoint record in the log.
54 The checkpoint will occur if either \fI<kbyte>\fP data has been written or
55 \fI<min>\fP minutes have passed since the last checkpoint.
56 Both arguments default to zero, in which case they are ignored. When
57 the \fI<min>\fP argument is non-zero, an internal task will run every 
58 \fI<min>\fP minutes to perform the checkpoint.
59 See the Berkeley DB reference guide for more details.
60 .TP
61 .B checksum
62 Enable checksum validation of DB pages whenever they are read from disk.
63 This setting can only be configured before any database files are created.
64 .TP
65 .BI cryptfile \ <file>
66 Specify the pathname of a file containing an encryption key to use for
67 encrypting the database. Encryption is performed using Berkeley DB's
68 implementation of AES. Note that encryption can only be configured before
69 any database files are created, and changing the key can only be done
70 after destroying the current database and recreating it. Encryption is
71 not enabled by default, and some distributions of Berkeley DB do not
72 support encryption.
73 .TP
74 .BI cryptkey \ <key>
75 Specify an encryption key to use for encrypting the database. This option
76 may be used when a separate
77 .I cryptfile
78 is not desired. Only one of
79 .B cryptkey
80 or
81 .B cryptfile
82 may be configured.
83 .TP
84 .BI dbconfig \ <Berkeley-DB-setting>
85 Specify a configuration directive to be placed in the
86 .B DB_CONFIG
87 file of the database directory. The
88 .B dbconfig
89 directive is just a convenience
90 to allow all necessary configuration to be set in the
91 .B slapd.conf
92 file.
93 The options set using this directive will only be written to the 
94 .B DB_CONFIG
95 file if no such file existed at server startup time, otherwise
96 they are completely ignored. This allows one
97 to set initial values without overwriting/destroying a 
98 .B DB_CONFIG 
99 file that was already customized through other means. 
100 This directive may be specified multiple times, as needed. 
101 For example:
102 .RS
103 .nf
104         dbconfig set_cachesize 0 1048576 0
105         dbconfig set_lg_bsize 2097152
106 .fi
107 .RE
108 .TP
109 .B dbnosync
110 Specify that on-disk database contents should not be immediately
111 synchronized with in memory changes.
112 Enabling this option may improve performance at the expense of data
113 security.
114 See the Berkeley DB reference guide for more details.
115 .TP
116 \fBdbpagesize \fR \fI<dbfile> <size>\fR
117 Specify the page size to use for a particular database file, in units
118 of 1024 bytes. The default for the
119 .B id2entry
120 file is 16, the default for all other files depends on the size of the
121 underlying filesystem's block size (typically 4 or 8).
122 The maximum that BerkeleyDB supports is 64. This
123 setting usually should not need to be changed, but if BerkeleyDB's
124 "db_stat \-d" shows a large amount of overflow pages in use in a file,
125 setting a larger size may increase performance at the expense of
126 data integrity. This setting only takes effect when a database is
127 being newly created. See the Berkeley DB reference guide for more details.
128 .TP
129 .BI directory \ <directory>
130 Specify the directory where the BDB files containing this database and
131 associated indexes live.
132 A separate directory must be specified for each database.
133 The default is
134 .BR LOCALSTATEDIR/openldap\-data .
135 .TP
136 .B dirtyread
137 Allow reads of modified but not yet committed data.
138 Usually transactions are isolated to prevent other operations from
139 accessing uncommitted data.
140 This option may improve performance, but may also return inconsistent
141 results if the data comes from a transaction that is later aborted.
142 In this case, the modified data is discarded and a subsequent search
143 will return a different result.
144 .TP
145 .BI dncachesize \ <integer>
146 Specify the maximum number of DNs in the in-memory DN cache.
147 Ideally this cache should be
148 large enough to contain the DNs of every entry in the database. If
149 set to a smaller value than the \fBcachesize\fP it will be silently
150 increased to equal the \fBcachesize\fP. The default value is 0 which
151 means unlimited, i.e. the DN cache will grow without bound.
152
153 It should be noted that the \fBDN cache\fP is allowed to temporarily
154 grow beyond the configured size. It does this if many entries are 
155 locked when it tries to do a purge, because that means they're
156 legitimately in use. Also, the \fBDN cache\fP never purges entries
157 that have cached children, so depending on the shape of the DIT, it 
158 could have lots of cached DNs over the defined limit.
159 .TP
160 .BI idlcachesize \ <integer>
161 Specify the size of the in-memory index cache, in index slots. The
162 default is zero. A larger value will speed up frequent searches of
163 indexed entries. An \fBhdb\fP database needs a large \fBidlcachesize\fP
164 for good search performance, typically three times the 
165 .B cachesize
166 (entry cache size)
167 or larger.
168 .TP
169 \fBindex \fR{\fI<attrlist>\fR|\fBdefault\fR} [\fBpres\fR,\fBeq\fR,\fBapprox\fR,\fBsub\fR,\fI<special>\fR]
170 Specify the indexes to maintain for the given attribute (or
171 list of attributes).
172 Some attributes only support a subset of indexes.
173 If only an \fI<attr>\fP is given, the indices specified for \fBdefault\fR
174 are maintained.
175 Note that setting a default does not imply that all attributes will be
176 indexed. Also, for best performance, an
177 .B eq
178 index should always be configured for the
179 .B objectClass
180 attribute.
181
182 A number of special index parameters may be specified.
183 The index type
184 .B sub
185 can be decomposed into
186 .BR subinitial ,
187 .BR subany ,\ and
188 .B subfinal
189 indices.
190 The special type
191 .B nolang
192 may be specified to disallow use of this index by language subtypes.
193 The special type
194 .B nosubtypes
195 may be specified to disallow use of this index by named subtypes.
196 Note: changing \fBindex\fP settings in 
197 .BR slapd.conf (5)
198 requires rebuilding indices, see
199 .BR slapindex (8);
200 changing \fBindex\fP settings
201 dynamically by LDAPModifying "cn=config" automatically causes rebuilding
202 of the indices online in a background task.
203 .TP
204 .B linearindex
205 Tell 
206 .B slapindex 
207 to index one attribute at a time. By default, all indexed
208 attributes in an entry are processed at the same time. With this option,
209 each indexed attribute is processed individually, using multiple passes
210 through the entire database. This option improves 
211 .B slapindex 
212 performance
213 when the database size exceeds the \fBdbcache\fP size. When the \fBdbcache\fP is
214 large enough, this option is not needed and will decrease performance.
215 Also by default, 
216 .B slapadd 
217 performs full indexing and so a separate 
218 .B slapindex
219 run is not needed. With this option, 
220 .B slapadd 
221 does no indexing and 
222 .B slapindex
223 must be used.
224 .TP
225 .BR lockdetect \ { oldest | youngest | fewest | random | default }
226 Specify which transaction to abort when a deadlock is detected.
227 The default is
228 .BR random .
229 .TP
230 .BI mode \ <integer>
231 Specify the file protection mode that newly created database 
232 index files should have.
233 The default is 0600.
234 .TP
235 .BI searchstack \ <depth>
236 Specify the depth of the stack used for search filter evaluation.
237 Search filters are evaluated on a stack to accommodate nested AND / OR
238 clauses. An individual stack is assigned to each server thread.
239 The depth of the stack determines how complex a filter can be
240 evaluated without requiring any additional memory allocation. Filters that
241 are nested deeper than the search stack depth will cause a separate
242 stack to be allocated for that particular search operation. These
243 allocations can have a major negative impact on server performance,
244 but specifying too much stack will also consume a great deal of memory.
245 Each search stack uses 512K bytes per level. The default stack depth
246 is 16, thus 8MB per thread is used.
247 .TP
248 .BI shm_key \ <integer>
249 Specify a key for a shared memory BDB environment. By default the
250 BDB environment uses memory mapped files. If a non-zero value is
251 specified, it will be used as the key to identify a shared memory
252 region that will house the environment.
253 .SH ACCESS CONTROL
254 The 
255 .B bdb
256 and
257 .B hdb
258 backends honor access control semantics as indicated in
259 .BR slapd.access (5).
260 .SH FILES
261 .TP
262 .B ETCDIR/slapd.conf
263 default 
264 .B slapd 
265 configuration file
266 .TP
267 .B DB_CONFIG
268 Berkeley DB configuration file
269 .SH SEE ALSO
270 .BR slapd.conf (5),
271 .BR slapd\-config (5),
272 .BR slapd (8),
273 .BR slapadd (8),
274 .BR slapcat (8),
275 .BR slapindex (8),
276 Berkeley DB documentation.
277 .SH ACKNOWLEDGEMENTS
278 .so ../Project
279 Originally begun by Kurt Zeilenga. Caching mechanisms originally designed
280 by Jong-Hyuk Choi. Completion and subsequent work, as well as
281 back-hdb, by Howard Chu.