0

We're about to replace a legacy MySQL database using master-slave replication (only 2 hosts total - one master, one slave) with a MariaDB Galera master-master replication cluster to ensure more hassle-free failovers. The tutorials I've read through usually instruct to create a HAproxy instance in front of the Galera nodes for loadbalancing among them (and to use more HAproxy instances sharing a virtual IP using keepalived if high availability is a requirement). This is what the suggested topology looks like.

However in our environment we're only going to have 2 Galera hosts in total (load is low so one host would be plenty) and the main requirement is redundancy with the eventual failover for the connected applications as seamless as possible.

Since a single host will have to be able to handle all the load in case of the other one's failure, loadbalancing would just obscure the point when it's necessary to upgrade the hardware and also possibly introduce unnecessary write conflicts. All queries should go to one host (with the other one just silently replicating) and only in case of the first one's failure should everything fail over to the second host, which should since then become the "main" one and be able to replicate everything back to the original failed host when it gets restored.

The question: if we only need redundancy and not loadbalancing, is it reasonable to omit the HAproxy instances in front of the Galera hosts altogether and just have the keepalived virtual IP shared directly by the two Galera instances? Or are the any noteworthy advantages (excluding simpler expansion to 3+ Galera hosts) to still use HAproxy in our situation?

2

Yes, a virtual IP should be enough.

However, you should have a third host running at least Galera arbitrator daemon, which takes care of quorum, that is deciding which one of the two nodes is the one in sync.

If there are only two nodes, and the other node goes down in unexpected fashion, and the node is brought up, the cluster state is unknown, because neither of the node knows if it is up-to-date or not.

For more information, look at https://www.sebastien-han.fr/blog/2012/10/10/galera-arbitrator-resource-agent/.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.