MySQL 复制:使用 HAProxy 和 HTTP-Check

MySQL Replication: Using HAProxy and an HTTP-Check

我阅读了 Github 工程 article 关于 MySQL Replication with HAProxy。给我的一段注释是:

In this situation, HAProxy no longer uses a mysql-check but rather an http-check. The MySQL backend server provides an HTTP interface, responding with HTTP 200 or HTTP 503 depending on replication lag. HAProxy will interpret these as “good” (UP) or “bad” (DOWN), respectively.

我不知道有任何 MySQL HTTP 服务。这是我必须编写的自定义脚本来提供这种类型的 http-check 吗?

MySQL 不提供 http 服务来报告其从属延迟。

如果您在 link 阅读的文章中进一步阅读,他们写了一个标题部分 "Implementing the check script",其中描述了他们为提供此报告而编写的自定义脚本。

他们link给脚本,写在bash:

https://github.com/github/mysql-haproxy-xinetd/blob/master/scripts/xinetd-mysql-check-lag