You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The script I describe there has served me well, but it's very hacky. It would be nice to have this integrated into the existing Web API (port 8008). In short, it would be an endpoint at a separate port that would return either READY on a write-accepting replica, or MAINT on a write-denying secondary. The API already works mostly like this in terms of detecting up/down hosts with the 200/503 status codes, but the key point of the agent-check is that the remote side is actively specifying the maintenance mode state in textual form regardless of status code.
Indeed, the feature is interesting, but agent-check makes a TCP connection to the configured port and only reads data from there without sending anything. Hence, it is not possible to serve it via the existing REST API port.
Running it on a separate port requires starting yet another thread and creating yet another port.
About 2-and-a-half years ago I wrote a blog post detailing how I was able to use the HAProxy
agent-check
feature to avoidDOWN
Patroni hosts, instead putting them intoMAINT
mode on a read/write backend when not primary. This is very useful if you are, for instance, monitoring for HAProxyDOWN
hosts for alerting or such, as otherwise 2/3 (or more) of your read/write backends would always reportDOWN
.The script I describe there has served me well, but it's very hacky. It would be nice to have this integrated into the existing Web API (port
8008
). In short, it would be an endpoint at a separate port that would return eitherREADY
on a write-accepting replica, orMAINT
on a write-denying secondary. The API already works mostly like this in terms of detecting up/down hosts with the 200/503 status codes, but the key point of theagent-check
is that the remote side is actively specifying the maintenance mode state in textual form regardless of status code.The HAProxy documentation for reference: https://cbonte.github.io/haproxy-dconv/1.8/configuration.html#5.2-agent-check
The text was updated successfully, but these errors were encountered: