Hello
I have a question about a problem that we run into regarding Postfix and
MySQL connection.
We have 3 servers running Percona XtraDB Cluster for mysql master-master
cluster, and 2 frontend servers running HAProxy + KeepAlived to balance
the traffic. We try to balance MySQL requests in HAProxy, but Postfix
doesn’t work well with this setup.
We use the floating IP address (handled by KeepAlived) in Postfix config
file, we expect Postfix can always connect to a mysql server. The
problem is, Postfix keeps persist sql connection to this server itself,
if currently connected mysql server is down, HAProxy will redispatch the
mysql request to another backend (this is expected), this breaks the
persist sql connection maintained by Postfix itself, so Postfix will
raise error and cannot reconnect.
*) Postfix supports auto reconnecting to another mysql server if we list
several mysql servers in its config file, but we have only one - the
floating IP address.
*) Postfix also supports auto reconnecting if we use a domain name (with
multiple A records in DNS) or multiple mysql nodes IPs as sql server
address. although no error raised with this method, we lose the
load-balance feature for mysql request.
So the question now is how to how to make Postfix work better with our
setup? One option is ProxySQL, looks promising, but we have to make
further configurations and tests.
Do any of you guys have similar implementations, and how do you handle
the Postfix connection to mysql cluster?
Any more information would be very appreciated.
Thank you very much!
Tomaž Brišnik