Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have the following setup:

enter image description here

I have configured high availability between two load balancers (HAProxy) so that if HAProxy1 get down, the floating IP gets transferred to the other load balancer HAProxy2, hence all the clients will get the response from HAProxy2, which at the back-end is doing LB among the sme two webserver. This is for removing the single point of failure in case of only one HAProxy.

Whenever I stops the hearbeat in HAProxy1, the floating IP goes to HAProxy2. But I want to configure such that whenever the process haproxy goes down, the floating IP should get assigned to HAProxy2. Can someone tell me how to implement it ?

share|improve this question

migrated from unix.stackexchange.com Aug 14 '12 at 13:45

This question came from our site for users of Linux, FreeBSD and other Un*x-like operating systems..

4 Answers 4

up vote 1 down vote accepted

in OCF you will not get the HAProxy, you need use the LSB class. Run below command to see the haproxy under lsb class

crm ra list lsb

then

crm configure primitive haproxy lsb:haproxy

and you are done.

share|improve this answer

I tried a lot using crm command ... I have added the floating IP using crm command..but not able to add haproxy using that..i tried a lot but not able to do that since there is no ocf named haproxy..Can u tell me the exact command

You can download haproxy ocf agent from the russki repo:

sudo wget -O /usr/lib/ocf/resource.d/heartbeat/haproxy http://github.com/russki/cluster-agents/raw/master/haproxy

then change the file permission:

sudo chmod 755 /usr/lib/ocf/resource.d/heartbeat/haproxy

and configure your resource like this:

# crm configure show

node node1
node node2
primitive failover-ip ocf:heartbeat:IPaddr2 \
    params ip="v.i.p.a" cidr_netmask="32" \
    op monitor interval="5s" \
    meta is-managed="true"
primitive haproxy ocf:heartbeat:haproxy \
    params conffile="/etc/haproxy/haproxy.cfg" \
    op monitor interval="30s" \
    meta is-managed="true"
colocation haproxy-with-failover-ip inf: haproxy failover-ip
order haproxy-after-failover-ip inf: failover-ip haproxy
property $id="cib-bootstrap-options" \
    dc-version="1.0.12-unknown" \
    cluster-infrastructure="openais" \
    no-quorum-policy="ignore" \
    expected-quorum-votes="2" \
    stonith-enabled="false" \
    last-lrm-refresh="1342783084"
share|improve this answer

It sounds like you've configured heartbeat properly, but haven't configured pacemaker.

Pacemaker is the part of the solution that monitors things like running services and makes the decision whether you need to switch to the other server or not.

http://itand.me/41901523 has a guide on setting it up for haproxy. You'll find plenty more if you google "pacemaker haproxy". Don't forget to read through all of pacemaker's documentation as well. There's a lot of important tidbits in there to getting everything running smoothly.

share|improve this answer

You need to configure the Pacemaker to monitor the service and make it available in case master (HAProxy1) fails. You can configure it through crm command and add floating IP as well as haproxy service to pacemaker.

share|improve this answer
    
I tried a lot using crm command ... I have added the floating IP using crm command..but not able to add haproxy using that..i tried a lot but not able to do that since there is no ocf named haproxy..Can u tell me the exact command –  pradeepchhetri Aug 14 '12 at 16:43

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.