openresty / lua-resty-upstream-healthcheck

Health Checker for Nginx Upstream Servers in Pure Lua
516 stars 134 forks source link

NO checkers problem? #38

Open wtiancai opened 7 years ago

wtiancai commented 7 years ago

openresty version is 1.11.2.2 A nginx & B nginx,have the same upstreams contents,eg: A: upstream app_cluster { ip_hash; server 192.168.0.100:9082; server 192.168.0.100:9083; } B: upstream proxy_AB { ip_hash; server 192.168.0.100:9082; server 192.168.0.100:9083; } after shutdown 9082&9083 app port server,the A nginx has correct check result: Nginx Worker PID: 21127 Upstream app_cluster Primary Peers 192.168.0.100:9082 DOWN 192.168.0.100:9083 DOWN Backup Peers

but the B nginx tips NO checkers,follow: Nginx Worker PID: 31735 Upstream proxy_AB (NO checkers) Primary Peers 192.168.0.100:9082 DOWN 192.168.0.100:9083 DOWN Backup Peers

=============================== B nginx is right?

jzh800 commented 7 years ago

A and B only name is difference?

jzh800 commented 7 years ago

if you turn on it, the status page will report (NO checkers) problem

lua_code_cache off;

yigitbasalma commented 6 years ago

Hi All;

I use nginx/1.10.3 and LuaJIT 2.0.4. I have to experience the same issue but a bit different. This is my upstream and health checker config

upstream test_xx_web_servers { server "172.18.178.21:80"; server "172.18.184.41:80";

keepalive 32;

}

lua_shared_dict healthcheck 1m; lua_socket_log_errors off;

init_worker_by_lua_block { local hc = require "resty.upstream.healthcheck" local ok, err = hc.spawn_checker{ shm = "healthcheck", upstream = "test_xx_web_servers", type = "http", http_req = "GET / HTTP/1.1\r\nHost: xx.com\r\n\r\n", interval = 2000, timeout = 1000, fall = 3, rise = 2, valid_statuses = {200, 302}, concurrency = 10, } if not ok then ngx.log(ngx.ERR, "failed to spawn health checker: ", err) return end }

This config working correctly but when I call /status page, I'm seeing "NO checkers" message.The response is below.

Upstream test_xx_web_servers:80 (NO checkers) Primary Peers 172.18.178.21:80 DOWN 172.18.184.41:80 up Backup Peers

How can I solve this?

agentzh commented 6 years ago

@yigitbasalma You should check your nginx's error log file for the error messages (if any) and make sure you did NOT turn off lua_code_cache. You need lua code cache to make this work properly (I don't think anyone should be using lua_code_cache off in production anyway).

yigitbasalma commented 6 years ago

@agentzh thank you for your answer.I upgraded my Nginx version to 1.12.3 and solved the problem.