1 | $Id: sqlite_drv.txt,v 1.3 2011/07/08 23:01:42 pcockings Exp $ |
---|
2 | |
---|
3 | COPYRIGHT (C) 2002-2012 DSPAM Project |
---|
4 | http://dspam.sourceforge.net |
---|
5 | |
---|
6 | LICENSE |
---|
7 | |
---|
8 | This program is free software: you can redistribute it and/or modify |
---|
9 | it under the terms of the GNU Affero General Public License as |
---|
10 | published by the Free Software Foundation, either version 3 of the |
---|
11 | License, or (at your option) any later version. |
---|
12 | |
---|
13 | This program is distributed in the hope that it will be useful, |
---|
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
16 | GNU Affero General Public License for more details. |
---|
17 | |
---|
18 | You should have received a copy of the GNU Affero General Public License |
---|
19 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
---|
20 | |
---|
21 | ABOUT |
---|
22 | |
---|
23 | - - ----------------------------------------------------------------------- - - |
---|
24 | - - Note: The sqlite_drv for using SQLite2 (>2.7.7) is not widely used and - - |
---|
25 | - - is likely to be removed in a future release. Please consider - - |
---|
26 | - - moving to SQLite3 and the sqlite3_drv instead. - - |
---|
27 | - - ----------------------------------------------------------------------- - - |
---|
28 | |
---|
29 | sqlite_drv and sqlite3_drv are SQLite storage drivers for DSPAM v3.0 and above. |
---|
30 | These drivers enables DSPAM to read and write all token, signature, and |
---|
31 | statistics data from individual SQLite databases created for each user. |
---|
32 | |
---|
33 | WARNING: SQLite is not designed to function over NFS. If your system is large |
---|
34 | enough to require NFS, it is strongly recommended you use a stateful |
---|
35 | SQL driver, such as MySQL or PostgreSQL. |
---|
36 | |
---|
37 | 1. CONFIGURING DSPAM |
---|
38 | |
---|
39 | To configure DSPAM to use a driver, use the following arguments while running |
---|
40 | DSPAM's configure: |
---|
41 | |
---|
42 | --with-storage-driver=sqlite_drv |
---|
43 | Tells DSPAM to use the sqlite_drv driver |
---|
44 | |
---|
45 | --with-storage-driver=sqlite3_drv |
---|
46 | Tells DSPAM to use the sqlite3_drv driver (for SQLite v3.x) |
---|
47 | |
---|
48 | --with-sqlite-libraries=/path/to/libs |
---|
49 | Tells DSPAM where to find the SQLite library (libsqlite.so). |
---|
50 | |
---|
51 | --with-sqlite-includes=/path/to/includes |
---|
52 | Tells DSPAM where to find the SQLite headers. |
---|
53 | |
---|
54 | After configure has successfully finished, build and install DSPAM using the |
---|
55 | instructions from DSPAM's readme. |
---|
56 | |
---|
57 | 2. OBJECT CREATION |
---|
58 | |
---|
59 | The drivers will automatically create the necessary database objects for each |
---|
60 | user upon first use of DSPAM by that user. |
---|
61 | |
---|
62 | 3. PURGING |
---|
63 | |
---|
64 | The purge script should be run against all databases periodically. The best |
---|
65 | way to do this is to use a find recipe such as: |
---|
66 | |
---|
67 | find /usr/local/var/dspam/data -name "*.sdb" -exec sqlite {} < /var/dspam/purge-2.sql \; |
---|
68 | |
---|
69 | or use sqlite3 and purge-3.sql if you're running sqlite3_drv. |
---|
70 | |
---|
71 | You may also wish to occasionally compact your databases. This should only |
---|
72 | be run once in a great while, and is not entirely necessary as SQLite will |
---|
73 | automatically reclaim space the next time it is used. Nevertheless, some |
---|
74 | databases can grow quite large if not purged well enough. Another find |
---|
75 | recipe such as the one below can be used to compact all databases on a |
---|
76 | system. |
---|
77 | |
---|
78 | find /usr/local/var/dspam/data -name "*.sdb" -exec echo 'vacuum;' \| sqlite {} \; |
---|
79 | |
---|
80 | or sqlite3, if you're running sqlite3_drv. |
---|
81 | |
---|
82 | 4. TUNING |
---|
83 | |
---|
84 | There are some tuning parameters which can be set, discussed here: |
---|
85 | http://sqlite.org/pragma.html#syntax |
---|
86 | |
---|
87 | Whenever sqlite_drv connects to a database, it will read |
---|
88 | $DSPAM_HOME/sqlite.pragma and execute any commands found in the file. For |
---|
89 | example, if you wish to turn off synchronous mode (which speeds up queries by |
---|
90 | as much as 50x, but could potentially risk database corruption on system |
---|
91 | crash), you could add this line to sqlite.pragma: |
---|
92 | |
---|
93 | PRAGMA synchronous = OFF |
---|
94 | |
---|
95 | Note: - Do not put a semicolon at the end of any statements in sqlite.pragma. |
---|
96 | - Comments are not allowed in sqlite.pragma. Anything you add to the file |
---|
97 | will be executed without being filtered. |
---|
98 | |
---|
99 | ERRORS |
---|
100 | |
---|
101 | Any SQL errors will be reported to LOGDIR/sql.errors as well as the standard |
---|
102 | syslog facilities (although the query will be truncated). |
---|
103 | |
---|
104 | QUESTIONS |
---|
105 | |
---|
106 | Please contact the dspam-dev mailing list with any questions or constructive |
---|
107 | feedback. |
---|
108 | |
---|
109 | Initial storage driver written by Jonathan A. Zdziarski <jonathan@nuclearelephant.com> |
---|
110 | and later enhanced by Stevan Bajic <stevan@bajic.ch> for DSPAM 3.9.0. |
---|