Scenario
For my application, I'd like to have highly available MySQL/MariaDB setup. I find the Galera Cluster
to be interesting in this case because of automatic data redundancy and immediate availability. My goals are this:
Hide cluster complexity from the application (the cluster can get bigger, and change topology adding some asynchronous nodes)
Handle failover outside of the application, transparently
Provide load balancing for certain common case writes and reads to both synchronous instances,
Still allow applications to access a certain, for e.g. async, node(s) which is optimized for, say, sequential reads for analytics. If this node fails I'd like the application to failover to a standard Galera instance, transparently to keep everything operational.
Done so far
I've read many articles about how to setup high availability and load-balanced MySQL
cluster with tandem of HAProxy
and Keepalived
, but none of them explains why use this duo for MySQL/MariaDB/Galera scenario at all. Some examples:
HAProxy+Keeplived, any MySQL CE cluster + Galera: https://severalnines.com/resources/tutorials/mysql-load-balancing-haproxy-tutorial
HAProxy+Keepalived, Galera Cluster: http://www.fromdual.com/making-haproxy-high-available-for-mysql-galera-cluster
HAProxy+Keepalived, async cluster: https://www.digitalocean.com/community/tutorials/how-to-use-haproxy-to-set-up-mysql-load-balancing--3
HAProxy only: https://www.digitalocean.com/community/tutorials/how-to-use-haproxy-to-set-up-mysql-load-balancing--3
When it comes to virtual IP assignment it is handled by Keepalived
based on its own scriptable health checkers and VRRP
.
Load-balancing is also supported by Keepalived
, there are multiple algorithms implemented by which connections are LB'd to destinations: https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Load_Balancer_Administration/ch-initial-setup-VSA.html
HAProxy offers some advanced features for HTTP, but this is just not my case.
The Question
What is the advantage of using HAProxy
with Keepalived
over just Keepalived
for MySQL for the scenario presented above?