← Back to team overview

mysql-proxy-discuss team mailing list archive

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=30000".
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



Follow ups