~ubuntu-branches/ubuntu/vivid/postfix/vivid-proposed

« back to all changes in this revision

Viewing changes to proto/PGSQL_README.html

  • Committer: Bazaar Package Importer
  • Author(s): LaMont Jones
  • Date: 2005-02-27 09:33:07 UTC
  • Revision ID: james.westby@ubuntu.com-20050227093307-cn789t27ibnlh6tf
Tags: upstream-2.1.5
ImportĀ upstreamĀ versionĀ 2.1.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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 PostgreSQL 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 PostgreSQL Howto</h1>
 
17
 
 
18
<hr>
 
19
 
 
20
<h2>Introduction</h2>
 
21
 
 
22
<p> The Postfix pgsql map type allows you to hook up Postfix to a
 
23
PostgreSQL database.  This implementation allows for multiple pgsql
 
24
databases: you can use one for a virtual(5) table, one for an
 
25
access(5) table, and one for an aliases(5) table if you want.  You
 
26
can specify multiple servers for the same database, so that Postfix
 
27
can switch to a good database server if one goes bad.  </p>
 
28
 
 
29
<p> Busy mail servers using pgsql maps will generate lots of
 
30
concurrent pgsql clients, so the pgsql server(s) should be run with
 
31
this fact in mind. You can reduce the number of concurrent pgsql
 
32
clients by using the Postfix proxymap(8) service. </p>
 
33
 
 
34
<h2>Building Postfix with PostgreSQL support</h2>
 
35
 
 
36
<p> Note: to use pgsql with Debian GNU/Linux's Postfix, all you
 
37
need to do is to install the postfix-pgsql package and you're done.
 
38
There is no need to recompile Postfix. </p>
 
39
 
 
40
<p> In order to build Postfix with pgsql map support, you specify
 
41
-DHAS_PGSQL, the directory with the PostgreSQL header files, and
 
42
the location of the libpq library file. </p>
 
43
 
 
44
<p> For example: </p>
 
45
 
 
46
<blockquote>
 
47
<pre>
 
48
% make tidy
 
49
% make -f Makefile.init makefiles \
 
50
        'CCARGS=-DHAS_PGSQL -I/usr/local/include/pgsql' \
 
51
        'AUXLIBS=-L/usr/local/lib -lpq'
 
52
</pre>
 
53
</blockquote>
 
54
 
 
55
<p> Then just run 'make'.  </p>
 
56
 
 
57
<h2>Configuring PostgreSQL lookup tables</h2>
 
58
 
 
59
<p> Once Postfix is built with pgsql support, you can specify a
 
60
map type in main.cf like this: </p>
 
61
 
 
62
<blockquote>
 
63
<pre>
 
64
/etc/postfix/main.cf:
 
65
    alias_maps = pgsql:/etc/postfix/pgsql-aliases.cf
 
66
</pre>
 
67
</blockquote>
 
68
 
 
69
<p> The file /etc/postfix/pgsql-aliases.cf specifies lots of
 
70
information telling postfix how to reference the pgsql database.
 
71
For a complete description, see the pgsql_table(5) manual page. </p>
 
72
 
 
73
<h2>Example: local aliases </h2>
 
74
 
 
75
<pre>
 
76
#
 
77
# pgsql config file for local(8) aliases(5) lookups
 
78
#
 
79
 
 
80
#
 
81
# The hosts that Postfix will try to connect to
 
82
hosts = host1.some.domain host2.some.domain
 
83
 
 
84
# The user name and password to log into the pgsql server.
 
85
user = someone
 
86
password = some_password
 
87
 
 
88
# The database name on the servers.
 
89
dbname = customer_database
 
90
 
 
91
# The table name.
 
92
table = mxaliases
 
93
 
 
94
# Query components, see below.
 
95
select_field = forw_addr
 
96
where_field = alias
 
97
 
 
98
# You may specify additional_conditions or leave this empty.
 
99
additional_conditions = and status = 'paid'
 
100
 
 
101
# The above variables will result in a query of the form:
 
102
#
 
103
# select forw_addr from mxaliases where alias = '$lookup' and status = 'paid'
 
104
#
 
105
# ($lookup is escaped so if it contains single quotes or other odd
 
106
# characters, it will not cause problems).
 
107
#
 
108
# You may also override the built-in SELECT template. See pgsql_table(5)
 
109
# for details.
 
110
</pre>
 
111
 
 
112
<h2>Using mirrored databases</h2>
 
113
 
 
114
<p> Sites that have a need for multiple mail exchangers may enjoy
 
115
the convenience of using a networked mailer database, but do not
 
116
want to introduce a single point of failure to their system.   </p>
 
117
 
 
118
<p> For this reason we've included the ability to have Postfix
 
119
reference multiple hosts for access to a single pgsql map.  This
 
120
will work if sites set up mirrored pgsql databases on two or more
 
121
hosts. </p>
 
122
 
 
123
<p> Whenever queries fail with an error at one host, the rest of
 
124
the hosts will be tried in random order.  If no pgsql server hosts
 
125
are reachable, then mail will be deferred until at least one of
 
126
those hosts is reachable. </p>
 
127
 
 
128
<h2>Credits</h2>
 
129
 
 
130
<ul>
 
131
 
 
132
<li> This code is based upon the Postfix mysql map by Scott Cotton
 
133
and Joshua Marcus, IC Group, Inc.
 
134
 
 
135
<li> The PostgreSQL changes were done by Aaron Sethman.
 
136
 
 
137
<li> Updates for Postfix 1.1.x and PostgreSQL 7.1+ and support for
 
138
calling stored procedures were added by Philip Warner.
 
139
 
 
140
<li> LaMont Jones was the initial Postfix pgsql maintainer.
 
141
 
 
142
<li> Liviu Daia revised the configuration interface and added the
 
143
main.cf configuration feature.
 
144
 
 
145
</ul>
 
146
 
 
147
</body>
 
148
 
 
149
</html>