I am using Haproxy to load balance replicated mysql master servers. I am also using Heartbeat and Pacemaker for Active/Active ip failover with two virtual ips on the two load balancers for web server high availability. I used location in pacemaker to stay VIPs one on each load balancer and I'm using round-robin DNS domains pointing to VIPs to load balance the load balancers. Everything looks fine so far!
|LB1: | Round-Robin -->| 1.2.3.4 | Heartbeat Pacemaker | Haproxy | 192.168.1.1
| | | | |
|LB2: | Round-Robin -->| 5.6.7.8 | Heartbeat Pacemaker | Haproxy | 192.168.1.2
crm configure show
node $id="394647e0-0a08-451f-a5bf-6c568854f8d1" lb1
node $id="9e95dc4f-8a9a-4727-af5a-40919ac902ba" lb2
primitive vip1 ocf:heartbeat:IPaddr2 \
params ip="1.2.3.4" cidr_netmask="255.255.255.0" nic="eth0:0" \
op monitor interval="40s" timeout="20s"
primitive vip2 ocf:heartbeat:IPaddr2 \
params ip="5.6.7.8" cidr_netmask="255.255.255.0" nic="eth0:1" \
op monitor interval="40s" timeout="20s"
location vip1_pref vip1 100: lb1
location vip2_pref vip2 100: lb2
property $id="cib-bootstrap-options" \
dc-version="1.0.8-042548a451fce8400660f6031f4da6f0223dd5dd" \
cluster-infrastructure="Heartbeat" \
stonith-enabled="false" \
no-quorum-policy="ignore" \
expected-quorum-votes="1"
How to configure Pacemaker so that if Haproxy on any load balancer is corrupted, it should still work either using haproxy on another lb or moving both the vips to working haproxy lb node. I DON'T want Active/Passive BUT Active/Active configuration as running haproxy on both the lbs responding to mysql requests.
Is it possible to do with Pacemaker? Anybody know?
Any help is greatly appreciated!. Thanks!
Update 1
That was a nice hint by @Arek B.
using clone
. I appended below line to pacemaker configuration but still couldn't exactly get what is actually required. I checked stopping haproxy
on both the LBs and it's automatically started by pacemaker but when I checked permanently stopping it(/etc/defaults/haproxy, enabled=0
), haproxy failed to start and in those case when it couldn't start haproxy, I want the resource(ipaddr2
) to be moved to another running haproxy lb. Any more hint?
primitive mysql_proxy lsb:haproxy \
op monitor interval="10s"
clone clone_mysql_proxy mysql_proxy \
meta clone-max="2" clone-node-max="1"
location mysql_proxy_pref1 clone_mysql_proxy 100: lb1
location mysql_proxy_pref2 clone_mysql_proxy 50: lb2