1<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"
2        "http://www.w3.org/TR/html4/loose.dtd">
3
4<html>
5
6<head>
7
8<title>Postfix CDB Howto</title>
9
10<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
11
12</head>
13
14<body>
15
16<h1><img src="postfix-logo.jpg" width="203" height="98" ALT="">Postfix CDB Howto</h1>
17
18<hr>
19
20<h2>Introduction</h2>
21
22<p> CDB (Constant DataBase) is an indexed file format designed by
23Daniel Bernstein. CDB is optimized exclusively for read access
24and guarantees that each record will be read in at most two disk
25accesses. This is achieved by forgoing support for incremental
26updates: no single-record inserts or deletes are supported.  CDB
27databases can be modified only by rebuilding them completely from
28scratch, hence the "constant" qualifier in the name.  </p>
29
30<p> Postfix CDB databases are specified as "cdb:<i>name</i>", where
31<i>name</i> specifies the CDB file name without the ".cdb" suffix
32(another suffix, ".tmp", is used temporarily while a CDB file is
33under construction).  CDB databases are maintained with the postmap(1)
34or postalias(1) command. The DATABASE_README document has general
35information about Postfix databases.  </p>
36
37<p> CDB support is available with Postfix 2.2 and later releases.
38This document describes how to build Postfix with CDB support. </p>
39
40<h2>Building Postfix with CDB support</h2>
41
42<p> These instructions assume that you build Postfix from source
43code as described in the INSTALL document. Some modification may
44be required if you build Postfix from a vendor-specific source
45package.  </p>
46
47<p> Postfix is compatible with two CDB implementations: </p>
48
49<ul>
50
51<li> <p> The original cdb library from Daniel Bernstein, available
52from http://cr.yp.to/cdb.html, and </p>
53
54<li> <p> tinycdb (version 0.5 and later) from Michael Tokarev,
55available from http://www.corpit.ru/mjt/tinycdb.html. </p>
56
57</ul>
58
59<p>  Tinycdb is preferred, since it is a bit faster, has additional
60useful functionality and is much simpler to use. </p>
61
62<p>To build Postfix after you have installed tinycdb, use something
63like: </p>
64
65<blockquote>
66<pre>
67% make tidy
68% CDB=../../../tinycdb-0.5
69% make -f Makefile.init makefiles "CCARGS=-DHAS_CDB -I$CDB" \
70    "AUXLIBS=$CDB/libcdb.a"
71% make
72</pre>
73</blockquote>
74
75<p> Alternatively, for the D.J.B. version of CDB:<p>
76
77<blockquote>
78<pre>
79% make tidy
80% CDB=../../../cdb-0.75
81% make -f Makefile.init makefiles "CCARGS=-DHAS_CDB -I$CDB" \
82    "AUXLIBS=$CDB/cdb.a $CDB/alloc.a $CDB/buffer.a $CDB/unix.a $CDB/byte.a"
83% make
84</pre>
85</blockquote>
86
87<p> After Postfix has been built with cdb support, you can use
88"cdb" tables wherever you can use read-only "hash", "btree" or
89"dbm" tables. However, the "<b>postmap -i</b>" (incremental record
90insertion) and "<b>postmap -d</b>" (incremental record deletion)
91command-line options are not available. For the same reason the
92"cdb" map type cannot be used to store the persistent address
93verification cache for the verify(8) service, or to store
94TLS session information for the tlsmgr(8) service. </p>
95