Hi
For test i runnig gallera claster + haproxy

haproxy:
.....
listen galera-test
bind 10.10.10.10:3307
balance leastconn
mode tcp
option tcplog
option tcpka
option httpchk

server sql1 10.10.10.11:3306 check port 9200 inter 12000 rise 2 fall 2
server sql2 10.10.10.12:3306 check port 9200 inter 12000 rise 2 fall 2
server sql3 10.10.10.13:3306 check port 9200 inter 12000 rise 2 fall 2
server sql4 10.10.10.14:3306 check port 9200 inter 12000 rise 2 fall 2

works fine (galera+haproxy+keepalive)

but ...
I had a problem once like scenario:


1)There was a problem with the network connection to the database sql2
2)Haproxy flagged "serwer sql2" as error and not letting new traffic to node sql2
3)Some connections were hanging from postfix to haproxy -> sql2
   like haproxy dont sent RST
4)old process cann connect to mysql - newer connections didn't have this problem and in logs i get many: warning: proxy:mysql:/etc/postfix/mysql_sender_login_maps.cf lookup error for "u...@domain.lt"
5)problem with sql2 wax fixed
6)some old process still can't connect to mysql - newer connections didn't have this problem

As if postfix wouldn't reconnect itself - after some times all works fine

And I would like to eliminate it and I dont have idea where i must find "problem"


I use everywhere  proxy:mysql:/etc/postfix/mysql_maps.....

W dniu 20.01.2023 o 18:43, Wietse Venema pisze:
natan:
W dniu 20.01.2023 o?15:04, Wietse Venema pisze:
natan:
Hi
I try to run "backup" transport maps like:

smtpd_sender_login_maps =
#first-main database
      proxy:mysql:/etc/postfix/mysql_sender_login_maps.cf
#second-backup
      proxy:mysql:/etc/postfix/mysql_sender_login_maps-backup.cf

Both databases are the same because they are synchronized (cluser
gallera) but the first is in other machines and second in local
(database ~150MB)

I am thinking of such a solution as if there was a problem with the
connection to the main database.

does this solution make sense?
Postfix does not know that the two databases are identical, and
therefore it must assume that the databases can return different
results. When databases can produce different results, skipping
a database can produce an incorrect result.

For correctness reasons, Postfix must stop when a database fails
to produce a result, and it must not skip to the next database.
Right. That would make a double query like
1)cannot find user in first go to second
Yes. The first database produces a reply (not found).

2)cannot connect first go to second
No. Here the dtabase produces no reply, and Postfix cannot know
that the two databases are identical, therefore it must not skip
the non-responding database.

That is the difference with a load balancer. A load balancer knows
that its backends provide an indentical service. If you need fast
fail over from one database mirror to another, use a load balancer.
I don't think that it would be a good idea to build a database load
balancer into Postfix.

        Wietse

--

Reply via email to