Introduction
In this post we will explore one approach to MySQL high
availability with HAProxy, Consul and Orchestrator.
Let’s briefly go over each piece of the puzzle first:
– HAProxy is usually installed on the application servers or an
intermediate connection layer, and is in charge of connecting the
application to the appropriate backend (reader or writer). The
most common deployment I’ve seen is to have separate ports for
writes (which are routed to the master) and reads (which are load
balanced over a pool of slaves).
– Orchestrator’s role is to monitor the topology and perform auto
recovery as needed.
The key piece here is how we can make HAProxy aware that a
topology change has happened, and the answer lies within Consul
(and Consul templates).
– Consul is meant to be told the identity of the new master by
Orchestrator. By leveraging Consul templates, we can then in turn
propagate that …