On Tue, 03 Nov 2009 16:21:04 +0100, "Dawid Sieradzki / Gadu-Gadu S.A."
<[email protected]> wrote:
> Hi,
> 
> Mysql persistent tcp balance problem.
> 
> MYSQL CLIENT ---- [CONN A] ----> LB TCP ---- [CONN B] ----> MYSQL
> DAEMON
> 
> When we did error on MYSQL daemon site (CONN B - BACKEND IS MARKED AS
> DOWN), haproxy will switch new connection to another mysql daemon.
> But current connections (CONN A) stay on broken line (CONN B)
> 
> The question is how to switch current mysql client connections hanged
> on haproxy to new MYSQL backend ?
> 
> Greetings
> 
You mean situation that
1.App is connecting [CONN A]
2.Does some queries
3.Then backend dies
4.Application wants to do more queries but backend dont respond and
timeout after x seconds, then app sends "DB connection refused"
??

If yes, only way (IMO) to do it in haproxy (as it knows nothing about
MySQL protocol) is:
1.set a short timeouts, like 10s
2.make application code like:

execute_query();
if (query_failed() && we_tried_to_reconnect_less_than_5_times()) {
 reconnect;
 try_query again
}

so when connection dies, instead of failin request it tries again and
get dispatched to other backen

PS. Jak wyłączyć w gg filtrowanie URLi od nieznajomych ? :D:D

-- 
Mariusz Gronczewski (XANi) <[email protected]>
GnuPG: 0xEA8ACE64
http://devrandom.pl

Attachment: signature.asc
Description: PGP signature

Reply via email to