I'm looking to deploy a MariaDB galera cluster across three servers. However, I've noticed that the documentation often references HAProxy or the like. Does this not cause a single point of failure situation?

I guess the question I'm asking is - Do I need any sort of load-balancing software to use a MariaDB cluster? Or could I have support for the cluster built-in to the app?

Apologies for the English.

  • HAProxy allows clustering, redundancy etc, so there is still no SPOF if it is configured correctly. Oct 13, 2016 at 10:53

2 Answers 2


You should use some kind of load-balancing solution, at least for these main reasons:

  • To equally balance the load between the nodes.
  • To check availability of the nodes and make it transparent as possible to your app.

If you use an HAproxy server you should have it replicated, so it's not a single point of failure, e.g. you can have two HAproxies in active/passive with a VIP* managed by keepalived, so if one dies, the other one starts taking the connections.

As you say, there are other options, as having local MySQL proxies in your application servers, or a pool of connections with health checks in your app backend.

If anyway you don't want to deploy any proxy, you can try to have a VIP (or some of them) managed by keepalived directly in your nodes, but with this solution it'd be more difficult to have fair balancing between the nodes and probably you wouldn't benefit so much of the cluster.

The best solution probably depends on the kind of load your cluster is going to have.

* VIP - Virtual IP. In keepalived terms it's an IP that is managed by keepalived. It's initially configured in the "active" host and if it dies, or some of its checks fail, or it's preempted by any other reason, then the keepalived daemons ensure that the IP is down in the failing host and is configured in the "passive" one.


In most cases you do need at least some failover mechanism with Galera to make sense.

You do not need LB in all cases, for example if you only need HA, with an app you cannot modify, you may want to write only one node at a time to avoid deadlocks and/or dropped writes. (In this case a vIP seems to be the best method). You could also separate reads and writes. This can be done either with a suitable SQL proxy, I do not have experience with any of them; or on app level, by specifying a write port (the vIP sitting on one of the Galera nodes and the right port) and a read port (the vIP sitting on a HAproxy node with RR-balanced Galera instances).

Take a look here: Keepalived vIP as Galera wsrep_cluster_address. The original question was a bit different, but the method described in my answer could also be used as a failover method over N nodes.

A few notes:

  • The method described in my answer does not provide (any) LB, only HA.
  • HAproxy alone introduces a SPOF, but it can be combined with keepalived to mitigate this (2 or more redundant HAproxy instances).

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.