Hello,
I am using both the lua-upstream-nginx and lua-resty-upstream-healthcheck modules and am looking for some clarification on how these modules work.
I have several groups of upstreams and i use spawn_checker to create a checker for each of the upstream groups. For example, here's one of the groups:
upstream default {
}
Let's say, once nginx starts, 10.11.12.13 is marked DOWN because it's actually down and 14.15.16.17 is up. So the /status endpoint would show:
1. if at this point i use `set_peer_down` to mark the 10.11.12.13 server up, it will be turned up (though it continues to be physically down) and it will not be turned down again by the checker after x number of failed healthcheck calls. In fact it seems like the healthchecks calls are not happening at this point, at least I am not seeing them in the logs. By the same token, if I need to disable a server which is actually up and i mark it down it will not be turned up after y number of successful healthcheck calls (but in this scenario i actually want it to stay down, whereas in the opposite scenario i don't want a server that's physically down to be considered up by the config). Is this expected behavior? Does using `set_peer_down` somehow interfere with the checkers from healthcheck module? And if yes, how can i modify this to only enable a server that is, in fact, up?
2. if i have multiple workers, and i use `set_peer_down` to disable a server inside an upstream block, do i need to synchronize the workers myself or will it get taken care of by the healthcheck module? I see that in the documentation for `set_peer_down` it says the following:
Note that this method only changes the peer settings in the current Nginx worker process. You need to synchronize the changes across all the Nginx workers yourself if you want a server-wide change (for example, by means of ngx_lua's ngx.shared.DICT).
But then I also found
this where agentzh suggests checking the healtcheck.lua library for details and
this google group discussion on the same issue. Now I am not sure if this means that
if I am already making use of the healthcheck library and spawned checkers for upstreams, the worker synchronization will be taken care of or still needs to be done explicitly by me.
3. slightly off topic question. when i define my upstream with hostnames instead of ip addresses, i see that when i use the /status endpoint or get_servers() from upstream the hostnames are resolved to ip addresses. is this because nginx internally resolves them to ips? is there a way to make it hold on to hostnames and show them instead of ips?
Thank you!
--