Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have have set up MySQL multi-master replication with HAProxy as a load balancer following Alex Williams' tutorial found here;

I am using a status checker found here;

as well as a replication checker found here;

The Mysql status checker works fine when I have the following line in my HAProxy config file:

server db02 check port 9200 inter 1s weight 1 rise 1 fall 1

But when I try to test the check replication script with this line:

server db02 check port 9201 inter 1s weight 1 rise 1 fall 1

and try to connect through the proxy I get a failure:

ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication  packet', system error: 0

When I telnet from the HAProxy machine to that port it works fine:

# telnet 9201

Connected to
Escape character is '^]'.
Replication slave is running
Connection closed by foreign host.

Is there any reason that that would not work while I can still check it through telnet? Is this a limitation of HAProxy? I would assume not as it seems that this is what others have used for their setups. Is it a configuration or permissions issue? I am confused as to how one of them would work and let me connect fine, but the other will not.

share|improve this question
What do you want to do with the replication script checker? Please show us the content of haproxy.cfg, /etc/xinetd.d/<replication_checker>? – quanta Jul 12 '12 at 3:15
I wanted to check if replication was working every time a connection was made through the proxy. I already gave the pertinent info from haproxy.cfg, and I know the xinetd service is running properly because I can telnet to the port and it runs the script. It is only when telling HAProxy to check the port for the replication checker that it fails. In any event, I just put the script to run every minute in crontab, which is suitable for my situation, although not exactly an answer to the question. – Joe Gibson Jul 12 '12 at 13:46
I need the full haproxy.cfg or at least MySQL backend section. – quanta Jul 12 '12 at 14:43

Your replication script run by xinetd should return HTTP 200 or 503, so HAProxy can detect the health of MySQL replication.

share|improve this answer

Your Answer


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.