我当前的设置中有2个HAProxies配置了keepalived for High Availability,这2个代理充当虚拟with服务的反向代理和负载均衡器。我知道HAProxy可以检查其后端的健康状况(我已经对此进行了配置),但我的问题是另一回事。
在我的公司有一个F5大IP负载均衡器,它是第一道防线,它会在需要时将请求重定向到我的HAProxies。
我需要知道是否有一种方法可以让我的F5大IP检查HAProxies前端的健康状况,以便在代理启动时不会丢失任何请求。
谢谢
发布于 2016-08-03 18:24:04
以前有一个mode health选项,但在最近的版本中,最简单的方法是在给定的端口上使用monitor-uri:
listen health_check_http_url
bind :8888
mode http
monitor-uri /healthz
option dontlognull您可以在前端使用monitor-uri,也可以通过ACL选择它,但端口版本非常清晰和简单。
https://cbonte.github.io/haproxy-dconv/1.6/configuration.html#4.2-mode
https://cbonte.github.io/haproxy-dconv/1.6/configuration.html#4.2-monitor-uri
发布于 2014-05-10 04:31:14
从HAProxy Reference Manual
Health-checking mode
--------------------
This mode provides a way for external components to check the proxy's health.
It is meant to be used with intelligent load-balancers which can use send/expect
scripts to check for all of their servers' availability. This one simply accepts
the connection, returns the word 'OK' and closes it. If the 'option httpchk' is
set, then the reply will be 'HTTP/1.0 200 OK' with no data, so that it can be
tested from a tool which supports HTTP health-checks. To enable it, simply
specify 'health' as the working mode :
Example :
---------
# simple response : 'OK'
listen health_check 0.0.0.0:60000
mode health
# HTTP response : 'HTTP/1.0 200 OK'
listen http_health_check 0.0.0.0:60001
mode health
option httpchk发布于 2019-04-01 21:04:34
从HAProxy文档
Example:
frontend www
mode http
acl site_dead nbsrv(dynamic) lt 2
acl site_dead nbsrv(static) lt 2
monitor-uri /site_alive
monitor fail if site_dead查看参考文档。
http://cbonte.github.io/haproxy-dconv/1.8/configuration.html#4.2-monitor-uri
<uri> is the exact URI which we want to intercept to return HAProxy's
health status instead of forwarding the request.
When an HTTP request referencing <uri> will be received on a frontend,
HAProxy will not forward it nor log it, but instead will return either
"HTTP/1.0 200 OK" or "HTTP/1.0 503 Service unavailable", depending on failure
conditions defined with "monitor fail". This is normally enough for any
front-end HTTP probe to detect that the service is UP and running without
forwarding the request to a backend server. Note that the HTTP method, the
version and all headers are ignored, but the request must at least be valid
at the HTTP level. This keyword may only be used with an HTTP-mode frontend.
Monitor requests are processed very early. It is not possible to block nor
divert them using ACLs. They cannot be logged either, and it is the intended
purpose. They are only used to report HAProxy's health to an upper component,
nothing more. However, it is possible to add any number of conditions using
"monitor fail" and ACLs so that the result can be adjusted to whatever check
can be imagined (most often the number of available servers in a backend).https://stackoverflow.com/questions/23512029
复制相似问题