MySQL 集群 SQL 节点故障转移

MySQL Cluster SQL node failover

我正在尝试为 Web 应用程序设置 mysql 集群以避免出现单点故障。 Mysql 文档说:

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.

文档说数据仍然可以通过 NDB API 访问,但是如果我的应用配置为指向 mysql 服务器,我如何设置某种类型的 loadbalancing/failover 对于多个 SQL 个节点。

故障转移功能由客户端连接器库提供。例如,如果您使用 Java,您的 JDBC 连接字符串可以提供 MySQL 主机名的列表。这是文档。 http://dev.mysql.com/doc/connector-j/5.1/en/connector-j-config-failover.html

对于 ado.net 和 python,您需要一个名为 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

的设置

或者,您可以编写检测连接超时的特定应用程序连接代码,然后尝试另一个 MySQL 服务器。