PXC and HAProxy HA on geo scale

Hi to all,
i’m new to PXC and I would like to setup a fully redundany infrastructure on geographical scale for some virtualization purposes.

I’m looking at PXC reference with HAProxy but in that scenario, HAProxy isn’t set in HA.
So, let’s assume a 3 nodes PXC, where each node is on a different location. What do you suggest for HAProxy with no SPOF at all ?

HA’ing HAproxy usually just means redundancy (i.e., two or more identical HAproxy servers) with keepalived managing a vip or vips that fail between the nodes. It’s perfectly possible to run HAproxy on your PXC nodes as well. Vips generally won’t work across multiple datacenters, so you’d have to rig up something else, or you could have vips in each DC with redundant HAproxy servers in each.

On a geo scale, I’d ask if you really want your apps to connect to a non-local DB. You may want different Haproxy configs for each DC anyway.

We are working on a similar setup and have diferent HA proxy configs for each data center so that each data center uses its own PXC nodes and falls-back to the other data center.

@sean So for setting up something like that did you create a 3 node PXC in data center1 and added another 3 nodes in datacenter2 or did you just make a 5 node PXC cluster (3 in DC1 and 2 in DC2. i am trying to understand the implications here from cluster perspective

Two nodes in each data center (I think we need a node in a third data center to avoid split brain, but we haven’t done that yet).

So it is like this:

center1-node1
center1-node2

center2-node1
center2-node2

We have Haproxy load balancers in both locations. In center1, there is an entry for dbserver on the HAproxy server. The config is center1-node1 & center1-node2 as primaries, center2-node1 and center2-node2 as backup. In center2, haproxy is set with center2-node1 and center2-node2 as dbserver, with center1-node1 and center2-node2 as backups.

For our setup, we have a /24 block that is announced out both data centers, so “dbserver” is an IP in that /24 so it works from both data centers. But you could just as easily configure the IP for dbserver in your /etc/hosts files. We do this with NFS servers in the two locations; nfs-server is a 10.10.10.0/255.255.255.0 address and there is one in each location that floats between servers within a data center using heartbeat.

sean