slapd-bdb.5 9.81 KB
Newer Older
1
.TH SLAPD-BDB 5 "RELEASEDATE" "OpenLDAP LDVERSION"
2
.\" Copyright 1998-2009 The OpenLDAP Foundation All Rights Reserved.
3
4
5
.\" Copying restrictions apply.  See COPYRIGHT/LICENSE.
.\" $OpenLDAP$
.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)
Kurt Zeilenga's avatar
Kurt Zeilenga committed
12
is the recommended primary backend for a normal 
13
14
.B slapd 
database.
15
It uses the Oracle Berkeley DB (BDB) package to store data.
16
It makes extensive use of indexing and caching to speed data access.
17
.LP
18
19
\fBhdb\fP is a variant of the \fBbdb\fP backend that uses a 
hierarchical database
Howard Chu's avatar
Howard Chu committed
20
layout which supports subtree renames. It is otherwise identical to
21
the \fBbdb\fP behavior, and all the same configuration options apply.
Howard Chu's avatar
Howard Chu committed
22
.LP
23
24
25
It is noted that these options are intended to complement
Berkeley DB configuration options set in the environment's
.B DB_CONFIG
26
file.  See Berkeley DB documentation for details on
27
.B DB_CONFIG
28
configuration options.
29
30
31
Where there is overlap, settings in
.B DB_CONFIG
take precedence.
32
.SH CONFIGURATION
Pierangelo Masarati's avatar
Pierangelo Masarati committed
33
34
These
.B slapd.conf
35
options apply to the \fBbdb\fP and \fBhdb\fP backend database.
Howard Chu's avatar
Howard Chu committed
36
37
That is, they must follow a "database bdb" or "database hdb" line and
come before any subsequent "backend" or "database" lines.
Pierangelo Masarati's avatar
Pierangelo Masarati committed
38
39
40
Other database options are described in the
.BR slapd.conf (5)
manual page.
41
.TP
42
.BI cachesize \ <integer>
Howard Chu's avatar
Howard Chu committed
43
Specify the size in entries of the in-memory entry cache maintained 
44
by the \fBbdb\fP or \fBhdb\fP backend database instance.
45
The default is 1000 entries.
46
.TP
47
48
49
50
51
.BI cachefree \ <integer>
Specify the number of entries to free from the entry cache when the
cache reaches the \fBcachesize\fP limit.
The default is 1 entry.
.TP
52
.BI checkpoint \ <kbyte>\ <min>
53
54
55
Specify the frequency for checkpointing the database transaction log.
A checkpoint operation flushes the database buffers to disk and writes
a checkpoint record in the log.
56
57
The checkpoint will occur if either \fI<kbyte>\fP data has been written or
\fI<min>\fP minutes have passed since the last checkpoint.
58
Both arguments default to zero, in which case they are ignored. When
59
60
the \fI<min>\fP argument is non-zero, an internal task will run every 
\fI<min>\fP minutes to perform the checkpoint.
61
62
See the Berkeley DB reference guide for more details.
.TP
63
64
65
66
.B checksum
Enable checksum validation of DB pages whenever they are read from disk.
This setting can only be configured before any database files are created.
.TP
Quanah Gibson-Mount's avatar
Quanah Gibson-Mount committed
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
.BI cryptfile \ <file>
Specify the pathname of a file containing an encryption key to use for
encrypting the database. Encryption is performed using Berkeley DB's
implementation of AES. Note that encryption can only be configured before
any database files are created, and changing the key can only be done
after destroying the current database and recreating it. Encryption is
not enabled by default, and some distributions of Berkeley DB do not
support encryption.
.TP
.BI cryptkey \ <key>
Specify an encryption key to use for encrypting the database. This option
may be used when a separate
.I cryptfile
is not desired. Only one of
.B cryptkey
or
.B cryptfile
may be configured.
.TP
86
.BI dbconfig \ <Berkeley\-DB\-setting>
87
88
89
90
91
92
93
94
Specify a configuration directive to be placed in the
.B DB_CONFIG
file of the database directory. The
.B dbconfig
directive is just a convenience
to allow all necessary configuration to be set in the
.B slapd.conf
file.
95
96
The options set using this directive will only be written to the 
.B DB_CONFIG
Quanah Gibson-Mount's avatar
Quanah Gibson-Mount committed
97
98
file if no such file existed at server startup time, otherwise
they are completely ignored. This allows one
99
100
101
102
103
to set initial values without overwriting/destroying a 
.B DB_CONFIG 
file that was already customized through other means. 
This directive may be specified multiple times, as needed. 
For example:
104
105
106
107
108
109
110
.RS
.nf
	dbconfig set_cachesize 0 1048576 0
	dbconfig set_lg_bsize 2097152
.fi
.RE
.TP
111
112
113
114
115
116
.B dbnosync
Specify that on-disk database contents should not be immediately
synchronized with in memory changes.
Enabling this option may improve performance at the expense of data
security.
See the Berkeley DB reference guide for more details.
117
.TP
118
119
120
121
122
123
124
125
126
127
128
129
130
\fBdbpagesize \fR \fI<dbfile> <size>\fR
Specify the page size to use for a particular database file, in units
of 1024 bytes. The default for the
.B id2entry
file is 16, the default for all other files depends on the size of the
underlying filesystem's block size (typically 4 or 8).
The maximum that BerkeleyDB supports is 64. This
setting usually should not need to be changed, but if BerkeleyDB's
"db_stat -d" shows a large amount of overflow pages in use in a file,
setting a larger size may increase performance at the expense of
data integrity. This setting only takes effect when a database is
being newly created. See the Berkeley DB reference guide for more details.
.TP
131
.BI directory \ <directory>
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
Specify the directory where the BDB files containing this database and
associated indexes live.
A separate directory must be specified for each database.
The default is
.BR LOCALSTATEDIR/openldap-data .
.TP
.B dirtyread
Allow reads of modified but not yet committed data.
Usually transactions are isolated to prevent other operations from
accessing uncommitted data.
This option may improve performance, but may also return inconsistent
results if the data comes from a transaction that is later aborted.
In this case, the modified data is discarded and a subsequent search
will return a different result.
.TP
147
148
149
150
.BI dncachesize \ <integer>
Specify the maximum number of DNs in the in-memory DN cache. The
default is twice the \fBcachesize\fP. Ideally this cache should be
large enough to contain the DNs of every entry in the database.
Quanah Gibson-Mount's avatar
Quanah Gibson-Mount committed
151
152
153
154
155
156
It should be noted that the \fBDN cache\fP is allowed to temporarily
grow beyond the configured size. It does this if many entries are 
locked when it tries to do a purge, because that means they're
legitimately in use. Also, the \fBDN cache\fP never purges entries
that have cached children, so depending on the shape of the DIT, it 
could have lots of cached DNs over the defined limit.
157
.TP
158
.BI idlcachesize \ <integer>
159
160
Specify the size of the in-memory index cache, in index slots. The
default is zero. A larger value will speed up frequent searches of
161
162
163
164
indexed entries. An \fBhdb\fP database needs a large \fBidlcachesize\fP
for good search performance, typically three times the 
.B cachesize
(entry cache size)
Howard Chu's avatar
Howard Chu committed
165
or larger.
166
.TP
167
\fBindex \fR{\fI<attrlist>\fR|\fBdefault\fR} [\fBpres\fR,\fBeq\fR,\fBapprox\fR,\fBsub\fR,\fI<special>\fR]
168
169
170
Specify the indexes to maintain for the given attribute (or
list of attributes).
Some attributes only support a subset of indexes.
171
If only an \fI<attr>\fP is given, the indices specified for \fBdefault\fR
172
173
are maintained.
Note that setting a default does not imply that all attributes will be
174
175
176
177
178
indexed. Also, for best performance, an
.B eq
index should always be configured for the
.B objectClass
attribute.
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193

A number of special index parameters may be specified.
The index type
.B sub
can be decomposed into
.BR subinitial ,
.BR subany ,\ and
.B subfinal
indices.
The special type
.B nolang
may be specified to disallow use of this index by language subtypes.
The special type
.B nosubtypes
may be specified to disallow use of this index by named subtypes.
194
195
196
197
198
199
200
Note: changing \fBindex\fP settings in 
.BR slapd.conf (5)
requires rebuilding indices, see
.BR slapindex (8);
changing \fBindex\fP settings
dynamically by LDAPModifying "cn=config" automatically causes rebuilding
of the indices online in a background task.
201
.TP
202
.B linearindex
203
204
205
Tell 
.B slapindex 
to index one attribute at a time. By default, all indexed
206
207
attributes in an entry are processed at the same time. With this option,
each indexed attribute is processed individually, using multiple passes
208
209
210
211
through the entire database. This option improves 
.B slapindex 
performance
when the database size exceeds the \fBdbcache\fP size. When the \fBdbcache\fP is
212
large enough, this option is not needed and will decrease performance.
213
214
215
216
217
218
219
220
Also by default, 
.B slapadd 
performs full indexing and so a separate 
.B slapindex
run is not needed. With this option, 
.B slapadd 
does no indexing and 
.B slapindex
221
must be used.
222
.TP
223
.BR lockdetect \ { oldest | youngest | fewest | random | default }
224
Specify which transaction to abort when a deadlock is detected.
225
The default is
226
227
.BR random .
.TP
228
.BI mode \ <integer>
229
230
231
Specify the file protection mode that newly created database 
index files should have.
The default is 0600.
232
.TP
233
.BI searchstack \ <depth>
234
Specify the depth of the stack used for search filter evaluation.
235
Search filters are evaluated on a stack to accommodate nested AND / OR
236
237
238
239
240
241
242
243
244
clauses. An individual stack is assigned to each server thread.
The depth of the stack determines how complex a filter can be
evaluated without requiring any additional memory allocation. Filters that
are nested deeper than the search stack depth will cause a separate
stack to be allocated for that particular search operation. These
allocations can have a major negative impact on server performance,
but specifying too much stack will also consume a great deal of memory.
Each search stack uses 512K bytes per level. The default stack depth
is 16, thus 8MB per thread is used.
245
.TP
246
.BI shm_key \ <integer>
247
248
249
250
Specify a key for a shared memory BDB environment. By default the
BDB environment uses memory mapped files. If a non-zero value is
specified, it will be used as the key to identify a shared memory
region that will house the environment.
251
252
253
254
255
256
257
.SH ACCESS CONTROL
The 
.B bdb
and
.B hdb
backends honor access control semantics as indicated in
.BR slapd.access (5).
Pierangelo Masarati's avatar
Pierangelo Masarati committed
258
.SH FILES
259
.TP
260
261
262
263
.B ETCDIR/slapd.conf
default 
.B slapd 
configuration file
264
.TP
265
.B DB_CONFIG
266
Berkeley DB configuration file
267
268
269
270
271
.SH SEE ALSO
.BR slapd.conf (5),
.BR slapd (8),
.BR slapadd (8),
.BR slapcat (8),
272
.BR slapindex (8),
273
Berkeley DB documentation.
Kurt Zeilenga's avatar
Kurt Zeilenga committed
274
275
.SH ACKNOWLEDGEMENTS
.so ../Project
276
277
278
Originally begun by Kurt Zeilenga. Caching mechanisms originally designed
by Jong-Hyuk Choi. Completion and subsequent work, as well as
back-hdb, by Howard Chu.