开发者

Mysql-Proxy Doesn't Failover (?)

开发者 https://www.devze.com 2023-04-04 13:30 出处:网络
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.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消