Automatic management
One of the goals of the dual master replication mode is to avoid doing a manual intervention on both servers when an issue occurs. We want to reduce the switching time as far as possible in case a server fails. To do so, multiple solutions exist and we're going to see some of them here.
HAProxy
HAProxy was discussed in Chapter 4, MariaDB Replication, to load balance against multiple slaves. We're now going to see how to do so on a dual master replication. To follow the rules, we should load balance on failover, not on configuration. So why should we use a load balancer if we do not have to load balance? Because HAProxy is powerful, easy to install, easy to maintain, and does the job perfectly.
Now let's see what failover means. Failover means if one server goes down, it should automatically switch to the other one. This action should be automatic, that is, without any human intervention!
The following diagram shows a comfortable scenario for this kind of project:
The dotted...