Reputation: 97
I'm trying to setup a mysql cluster for a web application to avoid having a single point of failure. The Mysql documentation says:
MySQL Cluster does not provide any sort of automatic failover between SQL nodes. Your application must be prepared to handle the loss of SQL nodes and to fail over between them.
The docs say the data is still accessible via the NDB API, but if my app is configured to point to a mysql server, how can i setup some type of loadbalancing/failover for multiple SQL nodes.
Upvotes: 1
Views: 675
Reputation: 108651
The failover functionality is provided by client connector libraries. For example, if you're using Java, your JDBC connection string can provide a list of MySQL host names. Here's documentation. http://dev.mysql.com/doc/connector-j/5.1/en/connector-j-config-failover.html
With ado.net and python, you'll need a setup called MySQL Fabric. This explains the connection string monkey business you'll need. http://dev.mysql.com/doc/connector-net/en/connector-net-programming-fabric.html
Or, you can write specific application connection code that detects connection timeouts, and then tries another MySQL server.
Upvotes: 2