source: npl/mailserver/dspam/dspam-3.10.2/doc/pgsql_drv.txt @ c5c522c

gcc484ntopperl-5.22
Last change on this file since c5c522c was c5c522c, checked in by Edwin Eefting <edwin@datux.nl>, 8 years ago

initial commit, transferred from cleaned syn3 svn tree

  • Property mode set to 100644
File size: 5.8 KB
Line 
1$Id: pgsql_drv.txt,v 1.5.3 2011/06/28 00:13:48 sbajic Exp $
2
3COPYRIGHT (C) 2002-2012 DSPAM Project
4http://dspam.sourceforge.net
5
6LICENSE
7
8This program is free software: you can redistribute it and/or modify
9it under the terms of the GNU Affero General Public License as
10published by the Free Software Foundation, either version 3 of the
11License, or (at your option) any later version.
12
13This program is distributed in the hope that it will be useful,
14but WITHOUT ANY WARRANTY; without even the implied warranty of
15MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16GNU Affero General Public License for more details.
17
18You should have received a copy of the GNU Affero General Public License
19along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
21ABOUT
22
23pgsql_drv is a PostgreSQL storage driver for DSPAM v3.0 and above.
24This driver enables DSPAM to read and write all token, signature,
25and statistics data from a PostgreSQL database. The advantages of
26using a SQL backend are obvious:
27
28- Centralized data storage
29- Structured queries for information
30- No need for context locking mechanisms
31
32REQUIREMENTS
33
34pgsql_drv storage driver requires PostgreSQL version 7.3 or higher.
35
361. CONFIGURING DSPAM
37
38To configure DSPAM to use pgsql_drv, use the following arguments while running
39DSPAM's configure:
40
41--with-storage-driver=pgsql_drv
42Tells DSPAM to use the pgsql_drv driver
43
44--with-pgsql-libraries=/path/to/libs
45Tells DSPAM where to find the Postgres client libraries.  They are usually
46located in /usr/local/pgsql/lib
47
48--with-pgsql-includes=/path/to/libs
49Tells DSPAM where to find the Postgres headers.  They are usually located in
50/usr/local/pgsql/include
51
52--enable-virtual-users
53Tells DSPAM to create virtual user ids for each dspam user.  Use this if your
54users don't really exist on the system (e.g. via getpwuid) or if you're doing
55something weird like sharing uids.
56
57After configure has successfully finished, build and install DSPAM using the
58instructions from DSPAM's readme.
59
602. CREATING PGSQL OBJECTS
61
62Before pgsql_drv will function, you must run pgsql_objects.sql file
63(located in src/tools.pgsql_drv) to create the table objects required by the
64driver.
65
66If you plan on enabling virtual users (something you'll need to do if the users
67don't actually exist on your system), also run virtual_users.sql.
68
69NOTE: If you are running pgsql < v8.0, you may get an error when running
70pgsql_objects.sql. It is safe to disregard this error, as it is for a function
71that is only used in v8.0+.
72
73NOTE: Install 'plpgsql' language on your dspam database before creating
74      actual dspam objects if postgresql server version 8.0 or higher:
75      $ createlang plpgsql dspam_db
76
773. CREATING A CONNECT DATA FILE
78
79pgsql_drv needs to know how to connect to your PostgreSQL database. You will
80need to specify this in dspam.conf. The file should already contain an example
81as shown below:
82
83PgSQLServer    127.0.0.1
84PgSQLPort      5432
85PgSQLUser      dspam
86PgSQLPass      changeme
87PgSQLDb        dspam
88
89Or if you'd like to connect using /tmp/.s.PGSQL.5432, use:
90
91PgSQLServer    /tmp
92PgSQLPort     
93PgSQLUser      dspam
94PgSQLPass      changeme
95PgSQLDb        dspam
96
97DSPAM checks to see if the first character of the HOSTNAME field is a slash,
98and if so will treat it like a socket file.
99
1004. NIGHTLY PURGE
101
102If you would like to purge the many stale tokens DSPAM will have lying around
103the database, you should run one of the provided purge scripts nightly. The
104dspam_clean tool may also be used for deeper cleansing.  See DSPAM's README
105for more information about the dspam_clean tool. 
106
107If you are supporting TOE-mode users on your system, you will want to do one
108of the following:
109
110  1. TOE-Mode a user preference
111
112     If you will support TOE-mode as a user option (preference), it is
113     recommended that you enable preferences-extension support and recompile,
114     then use the purge-pe.sql script nightly. The preferences-extension will
115     store user preferences in the database so that Postgres can query them.
116
117     NOTE: You should add a preference for any global users on your system, so
118     that their data is purged as if TOE-based (since global user data is
119     rarely updated). You can do this using:
120                                                                               
121     dspam_admin add pref [username] trainingMode TOE
122
123  2. Global TOE Support
124
125     If you will be using TOE mode globally (for all users), then you should
126     use purge.sql, but remove the following lines:
127
128     DELETE FROM dspam_token_data
129       WHERE CURRENT_DATE - last_hit > 90;
130
131     This will prevent the purging of stale tokens, which could cause serious
132     data loss in TOE databases (because tokens are never touched unless
133     an error has occured).  All other purges should be safe even for TOE-mode
134     users.
135
136If you will NOT be supporting TOE users on your system, you may simply run
137the purge.sql script nightly, as-is.
138
1395. TUNING
140
141PostgreSQL use sequential scan for newly created objects which will slow
142down everything. To use index scan force statistics collection by executing
143"ANALYSE" query manually, right after training first few mails. "ANALYSE" is
144included in purge.sql script. Thus new statistics will be collected daily.
145
146By default PostgreSQL sets tuneable parameters to minimum (i.e. shared memory
147size). To increase performance change "shared_buffers" and other values in
148postgresql.conf file. Kernel's shared memory related parameters also need to
149be tuned.
150
151ERRORS
152
153Any SQL errors will be reported to LOGDIR/sql.errors as well as the standard
154syslog facilities (although the query will be truncated).
155
156QUESTIONS
157
158Please contact the dspam-dev mailing list with any questions or constructive
159feedback.
160
161Initial storage driver written by Rustam Aliyev <rustam@azernews.com> and later
162enhanced by Stevan Bajic <stevan@bajic.ch> for DSPAM 3.9.0.
Note: See TracBrowser for help on using the repository browser.