Sticky failover for tcp?

From: Guy <wyldfury#gmail.com>
Date: Fri, 28 Nov 2008 14:36:44 +0000


Hi,

I've been trying out mysql-proxy to route connections to my two mysql servers (master - read/write and slave - read only) but support for the project just doesn't seem to be happening so I'm hoping haproxy can solve this problem for me.

For read only I want the slave to get all the reads and the master to get them only if the slave fails, so I'm assuming this would be sufficient?
===

listen sql_proxy 127.0.0.1:3306

        clitimeout 60000
        srvtimeout 50000
        contimeout 4000
        mode tcp
        balance roundrobin
        server slave x.x.x.x:3306 check port 3306 inter 3000
        server master x.x.x.x:3306 backup check port 3306 inter 3000

===

For any program that needs to write I'd like something a little more complex, but I'm not sure if it can be done or how. Programs needing to write connect to a different port and are sent to the mysql master. If the master fails checks a few times it should use the slave as backup and switch back to the master when it comes back, but if the master is down for an extended period (for example 10 minutes) it should switch to the slave and stay there.
===

listen sql_proxy 127.0.0.1:3307

        clitimeout 60000
        srvtimeout 50000
        contimeout 4000
        mode tcp
        balance roundrobin
        ???
        ???

===

Anyone have any idea how I could accomplish this?

Thanks
Guy

-- 
Don't just do something...sit there!
Received on 2008/11/28 15:36

This archive was generated by hypermail 2.2.0 : 2008/11/28 15:45 CET