1 |
Marcin Nis'kiewicz wrote: |
2 |
> Hello |
3 |
> I'm testing mail server with mysql backend. Generally it works quite |
4 |
> well. But from time to time during testing, single mails can't be send |
5 |
> because of smtp errors: |
6 |
> |
7 |
> in mail.log |
8 |
> Feb 3 13:47:37 mail postfix/smtpd[28339]: NOQUEUE: reject: RCPT from |
9 |
> unknown[ip]: 451 4.3.0 <user@××××××.org>: |
10 |
> <mailto:piotrpol@××××××××××.pl> Temporary lookup failure; |
11 |
> from=<user@××××××.org <mailto:piotrpol@××××××××××.pl>> |
12 |
> to=<user@×××××××.org <mailto:piotrpol@××××××××××.pl>> proto=ESMTP |
13 |
> helo=<domain.org <http://domain.org> > |
14 |
> in mail.warn |
15 |
> Feb 3 13:47:37 kurier4 postfix/trivial-rewrite[2438]: warning: |
16 |
> transport_maps lookup failure |
17 |
> |
18 |
> when I check transport_map: |
19 |
> |
20 |
> postconf | grep transport_map |
21 |
> address_verify_transport_maps = $transport_maps |
22 |
> fallback_transport_maps = |
23 |
> mailbox_transport_maps = |
24 |
> mydestination = $myhostname, localhost.localdomain, $transport_maps |
25 |
> proxy_read_maps = $local_recipient_maps $mydestination |
26 |
> $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps |
27 |
> $virtual_mailbox_domains $relay_recipient_maps $relay_domains |
28 |
> $canonical_maps $sender_canonical_maps $recipient_canonical_maps |
29 |
> $relocated_maps $transport_maps $mynetworks |
30 |
> transport_maps = mysql:/etc/mail/sql/mysql-transport.cf |
31 |
> <http://mysql-transport.cf> |
32 |
> |
33 |
> my /etc/mail/sql/mysql-transport.cf <http://mysql-transport.cf> looks |
34 |
> like that: |
35 |
> user = postfix |
36 |
> password = password |
37 |
> dbname = maildb |
38 |
> table = transport |
39 |
> select_field = destination |
40 |
> where_field = domain |
41 |
> hosts = 127.0.0.1 |
42 |
> |
43 |
> Generally I'm thinking that it could be mysql error - but there is |
44 |
> nothing wrong in its error log... |
45 |
> I set really big limit of concurrent connections |
46 |
> |
47 |
> max_user_connections = 1000 |
48 |
> |
49 |
> So what can be wrong? |
50 |
> Any ideas? |
51 |
> |
52 |
> Thank in progress for any help |
53 |
> best regards |
54 |
> nichu |
55 |
|
56 |
I think you've got a couple of problems, but none of them individually |
57 |
jump at as the cause of your problems. However making these three |
58 |
changes together might help. |
59 |
|
60 |
1. Turn your max_user_connections in Mysql down to something sane. |
61 |
Default is 100 which is fine unless you're also running a web app |
62 |
against the same Mysql instance. |
63 |
|
64 |
2. Use proxy in your Mysql connections from Postfix. |
65 |
Postfix can be configured to open a connection to Mysql and keep it |
66 |
open. Basically acts a connection pool and keep Postfix from opening |
67 |
hundreds of connections to Mysql on a very busy server. I recommend |
68 |
*always* using the proxy: statement anytime you're connecting to Mysql |
69 |
from Postfix. Your new transport_map statement will look like this. |
70 |
|
71 |
transport_maps = proxy:mysql:/etc/mail/sql/mysql-transport.cf |
72 |
|
73 |
Generally you shouldn't be running into connection issues because you're |
74 |
hitting Mysql on localhost which means it'll default to a socket |
75 |
connection. It's possible that opening a new session is taking to too |
76 |
long occasionally and using proxy should alleviate that. |
77 |
|
78 |
3. You're using Postfix 2.1 or earlier query syntax. |
79 |
Hell it might even be Postfix 1.x syntax. This is the new syntax for |
80 |
Postfix 2.2 or better. This really isn't a problem, but the new syntax |
81 |
is far more powerful and suspect bugs that creep into the parser around |
82 |
old syntax aren't noticed or getting fixed. |
83 |
|
84 |
user = postfix |
85 |
password = password |
86 |
hosts = localhost |
87 |
dbname = maildb |
88 |
query = SELECT destination FROM domain WHERE domain='%s' |
89 |
|
90 |
I'm not sure what how-to you've been using, but I'd look at a few others |
91 |
to see some of the other options available. The one you're using seems |
92 |
to be pretty far out of date. While not wrong in any way it isn't taking |
93 |
full advantage of the last seven years of updates in Postfix. |
94 |
|
95 |
kashani |