← Back to team overview

mysql-proxy-discuss team mailing list archive

Re: MySQL Proxy 0.8.0 load balancing

 

Hey Greg,
What LUA script are you using? I'm using a slightly tweeked version of
this:

http://forge.mysql.com/tools/tool.php?id=125

and it works as expected. Though, in my instance (and the instance of
the above script), it will always choose server #1 unless it is down.

-Matthew

> -----Original Message-----
> From: mysql-proxy-discuss-
> bounces+mboehm=theplanet.com@xxxxxxxxxxxxxxxxxxx [mailto:mysql-proxy-
> discuss-bounces+mboehm=theplanet.com@xxxxxxxxxxxxxxxxxxx] On Behalf Of
> Greg Thomas
> Sent: Wednesday, January 27, 2010 6:13 AM
> To: mysql-proxy-discuss@xxxxxxxxxxxxxxxxxxx
> Subject: [Mysql-proxy-discuss] MySQL Proxy 0.8.0 load balancing
> 
> Hi,
> I've just downloaded MySQL Proxy 0.8.0 (on Windows) to see if I could
> use it as a load balancer/failover mechanism - and I seem to be
> failing at that. I'm probably missing something, so can anyone suggest
> what?
> 
> I'm starting the proxy like ...
> 
> mysql-proxy.exe --proxy-address=localhost:3306
> --proxy-backend-addresses=server1:3306
> --proxy-backend-addresses=server2:3306 --log-level=debug
> 
> When both servers are running, the client connecting via the proxy
> connects to them in a round robin fashion as expected - server1 50% of
> the time, and server2 50% of the time.
> 
> However, if I shut down server1, then the client gets a connection
> failure 50% of the time, and connects to server2 50% of the time. I'd
> expect from the docs at
> http://dev.mysql.com/doc/refman/5.1/en/mysql-proxy-using.html that I'd
> end up on server2 100% of the time ("When you have specified multiple
> servers in this way, the proxy will automatically identify when a
> MySQL server has become unavailable and mark it accordingly. New
> connections will automatically be attached to a server that is
> available, and a warning will be reported to the standard output from
> mysql-proxy").
> 
> My test client is a tiny Java program, with a connection string of
>
"jdbc:mysql://localhost:3306/test?connectTimeout=30000&socketTimeout=30
> 000".
> When it attempts to connect to the server that is turned off, it
> throws "com.mysql.jdbc.exceptions.jdbc4.CommunicationsException:
> Communications link failure" 30 seconds after it attempted to connect;
> i.e. my specified timeout.
> 
> If it makes any difference, the client and two servers are all Win32
> machines, and I'm turning off server1 by simply stopping the MySQL
> Windows server.
> 
> Any help gratefully received!
> 
> Greg
> 
> _______________________________________________
> Mailing list: https://launchpad.net/~mysql-proxy-discuss
> Post to     : mysql-proxy-discuss@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~mysql-proxy-discuss
> More help   : https://help.launchpad.net/ListHelp



Follow ups

References