大家好,
我openresty設定一個upstream
upstream node-cluster {
least_conn;
server 127.0.0.1:8080;
server 127.0.0.1:8081;
server 127.0.0.1:8082;
}
我看了一下文件並且測試了一下
http://nginx.org/en/docs/http/ngx_http_upstream_module.html#match
看起來upstream module會load balancing所有servers,如果其中一台socket連不上則會嘗試下一台。
我的問題是,如果我要驗證返回不是200 OK的情況則直接嘗試下一台,原生的upstream module是否能做到?
我看到這個模塊有支持health_check功能,但看起來是nginx periodically check upstream servers,而不是跟隨真實請求返回進行fail-over處理。
因此我想知道如果要實現upstream的fail-over功能,並且是基於http response code,有什麼好方法嗎?