来自f5负载均衡器的Cassandra多数据中心集群健康检查

时间:2017-04-24 05:49:36

标签: cassandra f5

我在两个数据中心有一个工作的cassandra集群。每个DC有3个节点,复制因子为3,READ / WRITE一致性为LOCAL_QUORUM。

我希望在DC中的两个节点关闭时停止到特定DC的流量,因为不再满足仲裁。我希望这可以由我的应用程序(客户端)处理,即当不满足本地仲裁时连接到其他DC cassandra但是不可能从那里开始。

我们可以在f5负载均衡器上设置某种规则来实现这一目标吗?

1 个答案:

答案 0 :(得分:1)

You can setup an external monitor on the BIG-IP to run a script determining cluster health and then load balance on the results. If you're using BIG-IP 11.x+ you create your script and import it, adding any needed arguments it may require. Then you create a monitor profile to call that external monitor.

If you have a DevCentral account, check out this page:

DevCentral Wiki: External Monitor

Scroll down and you'll see a ton of examples to build off. Examples to note are the MySql monitors. This is the path I would recommend for cluster health checks for BIG-IP.

Alternatively, you can simply query a web page looking for a success/failure message so if you already have a cluster health status page, you can have an HTTP monitor validate the message. You can customize the receive string to look for specific content or use regex to look for any specific string (such as clusterFailure or whatnot). From there, you can make the appropriate LB decisions. I ran a similar monitor that read a nagios status page and if it read a failure on a specific message, it would LB connections from that node.

Here's some info on regex with http monitors.