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
2)cannot connect first go to second
If found in first database go back
This would all be fine if the base was synchronized (mysql galera
watches over it) but sometimes double query.
Or maby use localhaproxy ?
Yes, if you have haproxy tests that validate the database response,
i.e. the database produces the expected answer for a specific query.
Merely making a TCP connection is not sufficient.
Thinking about
server galera01 10.10.10.10:3306
server galera02 127.0.0.1:3306 backup
and special check database
Wietse
Why I ask. Because I had a problem once like scenario:
1)There was a problem with the network connection to the database
(problem with switch)
2)Postfix cannot connect to mysql - It is obvious
3)problem with switch was fixed (1m)
4)some old process cann 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
I use everywhere proxy:mysql:/etc/postfix/mysql_maps.....
--