I have a simple configuration of 2 MySQL being load balanced by HAProxy. For an unfortunate reason I need to use them in Passive\Active mode. So I thought I'd configure one DB as 'backup' and go to sleep. But I was wrong. Whenever I add the 'backup' to the server line HAProxy throws a communication link error (essentially saying 'no DB available" (with the 'backup' it works great). It just doesnt consider that server as a valid option any more...

I have tried this configuration:

listen mysql 10.0.0.109:3307

    mode tcp
    balance roundrobin
    option httpchk
    server db01 10.0.0.236:3306
    server db02 10.0.0.68:3306 backup

and also this configuration:

frontend mysql_proxy

    bind 10.0.0.109:3307
    default_backend mysql

backend mysql

mode tcp
balance roundrobin
option httpchk
server db01 10.0.0.236:3306  
server db02 10.0.0.68:3306 backup

Nothing worked!

Can anyone point me in the right direction?

Thanks

link|improve this question
feedback

1 Answer

what haproxy version are you using ?, if you are using version 1.4, it's support mysql health check "option mysql-check" e.g:

mode tcp
balance roundrobin
option tcplog
option mysql-check user haproxy
server svr1 svr1:3306 check inter 2s rise 2 fall 2
server svr2 svr2:3306 check backup inter 2s rise 2 fall 2

my setup, it's working fine with mysql master - master (using active standy).

link|improve this answer
I have the latest version (1.4.8). For some reason it just refuses to accept the 'backup' keyword. What version are you using? – A.RG Oct 13 '11 at 17:09
haproxy-1.4.15, are you sure 1.4.8 ?, the latest is 1.4.18 based on haproxy.1wt.eu/#down. could you remove "option httpchk" ? – Rikih Oct 14 '11 at 2:43
feedback

Your Answer

 
or
required, but never shown

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