Failover on MySQL JDBC connections?

2019-07-22 02:04发布

问题:

I am trying to determine how i could implement a high availablity solution using the MySQL JDBC driver, it seems that there is a failover property that I can set. But I am wondering what people tend to use when implement a simple failover mechanism using MySQL and JDBC?

We are planning to have 2 front Tomcat servers connected to 2 MySQL servers.

回答1:

Even though you're asking about JDBC, I hope this helps you understand all available options...

I typically handle failover by using a load balanced configuration that can gracefully failover, rather than at the JDBC layer.

MySQL Proxy is one way to accomplish that:

http://www.cyberciti.biz/tips/mysql-proxy-howto.html