简体   繁体   中英

Mysql-Proxy Doesn't Failover (?)

This is the first time I am using mysql-proxy and I am experiencing the weird behavior I was wondering if the community has tackled it before.

I have mysql-proxy (0.8.2) running on amazon linux (in ec2) connected to 2 mysql servers. My java client can connect to the proxy and load balancing works fine.

My problem is this: I have a client that is connected (via the proxy) to a server A. It works great until i test the fail-over. When I close server A and the client tries to execute simple insert command (on an already established connection), I was expecting the proxy to redirect the request to server B. However I am getting this exception:

com.mysql.jdbc.exceptions.jdbc4.CommunicationsException : Communications link failure.

The client in this case is a Java program using mysql-connector-java-5.1.17-bin.jar

Any ideas how to solve this or am I missing anything here?

Here's an update on this issue, in case some else has the same problem.

It seems that mysql-proxy checks the status on the back-end server when the client connects to it. It doesn't perform any keepalive\\heartbeat with the DBs. I have tried to force such behavior using lua scripts but failed miserably.

A potential alternative might be to use HAProxy and include xinted mysqlchecks. I haven't tried it personally. We'll probably end up building a proxy connection client that will wrap java.sql.Connection and will interact with mysql-proxy appropriately.

Let me know if you found other ways to achieve the above.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM