HAProxy and MySQL

From: Jill Rochelle <jrochelle#digitalchalk.com>
Date: Mon, 8 Oct 2007 13:17:35 -0400


I have a couple of issues with HAProxy and MySQL:  

  1. Implementing HAProxy to send connections to multiple SQL servers that are part of a MySQL cluster and have the check option work?

We had 2 sql servers . seemed to be working fine . one server went down and haproxy still kept trying to send connections to it. I added the check parameter

            thinking this would allow haproxy to know that the server is dead . however I got this error after a short time  

Caused by: java.sql.SQLException: null, message from server: "Host 'domU-12-31-35-00-52-44.z-2.compute-1.internal' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'"  

My guess is that the check is not making a valid connection with a user, password and database and that's why I get this. Possible?    

2) I believe it may be timeout issues on connection. This is what I get after I log in and then wait a bit before doing anything ..  

Could not open Hibernate Session for transaction; nested exception is org.hibernate.TransactionException: JDBC begin failed  

            Once I keep moving it's fine . I also had to remove all the connection timeouts for this error not to occur    

Any assistance is greatly appreciated.  

Thank you,

Jill    

Environment

FC4

Tomcat

Terracotta

MySQL Cluster

HAProxy routing connections for mysql and eventually tomcat      

Here is the haproxy config for the the mysql connection    

listen mysql 0.0.0.0:3306

        mode tcp

        log global

        balance roundrobin

        server sql1 *.*.*.* check inter 2000 rise 2 fall 3 port 3306

        server sql2 *.*.*.* check inter 2000 rise 2 fall 3 port 3306

        maxconn 6000

        contimeout 150000

        clitimeout 150000

        srvtimeout 150000

        option tcpka       Received on 2007/10/08 19:17

This archive was generated by hypermail 2.2.0 : 2007/11/04 19:21 CET