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