2 Using Citadel/UX with Sleepycat (Berkeley) DB
6 [1]Citadel/UX can now use the robust and scalable [2]Berkeley DB from
7 Sleepycat Software as its data store, for increased scalability,
8 reliability, and recoverability.
10 History and introduction
12 From its inception in 1987 until versions 5.1x in 1998,
13 Citadel/UX utilized a built-in data store loosely modelled after Jeff
14 Prothero's original Citadel-CP/M design. But as Citadel systems
15 scaled upwards, supporting Internet-connected systems with heavy
16 concurrent use, and aspirations of becoming a world-class
17 messaging/groupware platform someday, the developers made the decision
18 to switch to an embedded database. The Free Software Foundation's
19 [3]GDBM product was chosen for its simple API and its free license
22 Somewhat less than trouble-free operation from 1998 through 2000,
23 however, proved that GDBM was not the best choice. Heavily utilized
24 systems experienced occasional database corruption, often resulting in
25 repeated crashes of the Citadel server. As a result, we made the
26 decision to switch to [4]Berkeley DB.
28 Berkeley DB offers [5]numerous features which help Citadel/UX to meet
29 its goals as a high-end messaging platform:
30 * Database sizes can scale to hundreds of terabytes
31 * A transaction-based logging system
34 It is clear that Berkeley DB is a better choice than GDBM for a
35 high-utilization database that requires crash recovery. Beginning on
36 December 7, 2000, Citadel/UX supports the use of either GDBM or DB as
37 the data store. As of July 1, 2001, DB has become the default. We
38 recommend DB in preference to GDBM wherever possible because there is
39 no effective way to recover from corrupted GDBM files.
42 Building Citadel/UX with DB support
44 Here are the steps required to get Citadel/UX running with Berkeley
45 DB as its back end data store.
47 1. First, you must download and build Berkeley DB itself. Citadel
48 has been developed and tested with DB 3.1.17, which can be
49 downloaded from [6]www.sleepycat.com. Follow the "[7]Building for
50 UNIX" instructions. Make sure that you run the test suite, and
51 perhaps test with some of the sample applications, before moving
54 Note that as of DB 3.1.17, DB's configure script can't check for
55 OpenBSD systems. You will need to configure DB as follows:
57 env CC='gcc -pthread -Di386' ../dist/configure [flags]
59 DB 3.3.x's configure script should not need the -Di386 flag.
61 2. Start with a clean source tree. Either unpack a fresh copy of the
62 source or do a "make distclean" before continuing.
63 3. Run the configure script: ./configure
64 (Optionally specify --with-db=DIR for whatever prefix
65 you've actually installed DB into, if you overrode DB's defaults.
66 Also specify any other configure options you need at this time.)
67 4. Run "make" and "make install-exec." Continue installing Citadel
68 as per the instructions supplied with the system.
70 Migrating an existing GDBM-based Citadel to a DB-based Citadel
72 If you have an existing system, you must export your databases,
73 rebuild Citadel with DB support, and then re-import your databases
74 into the new system. Please refer to the document "[8]How to use the
75 importer/exporter" for detailed instructions on this.
77 After you export your database, but before you re-import it, you must
78 perform the following steps:
79 1. Re-build Citadel with DB support, as described above
80 2. Remove all of the *.gdbm files from your data directory.
82 Care and feeding of your DB-powered Citadel
84 Citadel uses the transaction-based logging facility of Berkeley DB.
85 Therefore you will notice log files accumulating in your data
86 directory. These are required for automatic recovery in the event of
87 a catastrophic system failure. Log files have filenames that look
88 like "log.0000000001" whereas the normal database files have names
91 So do you have to keep these log files around forever? No, but there
92 are some rules you should follow:
93 * Don't remove a log file if it's the only log file there.
94 * If it's not listed in the output of the db_archive[9] command, it's
96 * After a successful backup (see below) log files listed by the
97 db_archive[9] command may be removed to conserve disk space, if
98 those log files were backed up.
100 You may think that it's going to keep writing to that one log file
101 forever, but don't panic; when the log file gets sufficiently large it
102 will switch over to another one. As a general rule of thumb, your
103 archival procedure should be to back up to tape every day, removing log
104 files after backups as described above. Berkeley DB supports "hot"
105 backups; in other words, you are permitted to back up your Citadel data
106 without having to first shut down the Citadel server, AS LONG AS YOU
107 COPY THE DATA FILES BEFORE THE LOG FILES. One way to ensure this is to
108 first copy the data files to a temporary directory, then copy the log
109 files to the same temporary directory, and finally back up and remove
110 the temporary directory. This temporary-directory procedure also makes
111 it easy to determine which log files made it onto the backup when
112 determining what is safe to remove. (See above.)
116 1. http://uncensored.citadel.org/citadel
117 2. http://www.sleepycat.com/
118 3. http://www.gnu.org/software/gdbm/gdbm.html
119 4. http://www.sleepycat.com/
120 5. http://www.sleepycat.com/xactfeatures.html
121 6. http://www.sleepycat.com/
122 7. http://www.sleepycat.com/docs/ref/build_unix/intro.html
123 8. http://pixel.citadel.org/citadel/docs/export.html
124 9. http://www.sleepycat.com/docs/utility/db_archive.html