per https://doc.dovecot.org/configuration_manual/authentication/sql/, you can add more than one "host=" parameter in the "connect" directive, and leave dovecot to do round-robin load balancing. there will probably be a delay in processing while a failed database connection attempt times out.
or you can use a load balanced database footprint, using something like haproxy. its not as simple as putting multiple databases behind haproxy and calling it done. i use mariadb, which via galera, can do multi-primary HA, where all 3 primary instances can take write or read events. you need to configure each mariadb instance with galara replication and then setup haproxy to properly attach to the databases and perform a service check.
postgresql or other databases may require different mechanisms to achieve fault tolerant HA.
On 8/30/22 4:18 AM, Sami Ketola wrote:
On 30. Aug 2022, at 5.13, Jack Snodgrass <jack@mylinuxguy.net> wrote:
I am using this file:
dovecot-sql.conf.ext
and in there I have a
connect = "host=<dbserver> dbname=<dbname> user=<dbuser> password=<dbpass>"
My <dbserver> was down and I lost mail access for a few days before I realized that there was an issue. How can I specify a backup server so that if my primary sql server goes down, a backup sql server will be queried?
Use haproxy.
Sami