问题描述
在 Nginx 示例配置文件中 https://github.com/defunkt/unicorn/blob/master/examples/nginx.conf 你可能会看到:
# The only setting we feel strongly about is the fail_timeout=0
# directive in the "upstream" block. max_fails=0 also has the same
# effect as fail_timeout=0 for current versions of Nginx and may be
# used in its place.
据我所知,如果请求之一因超时而终止或返回被视为错误请求的内容({{3 }}).
所以在 504 Bad Request
块中他们有:
upstream
我在 upstream app_server {
# fail_timeout=0 means we always retry an upstream even if it Failed
# to return a good HTTP response (in case the unicorn master nukes a
# single worker for timing out).
# for UNIX domain socket setups:
server unix:/path/to/.unicorn.sock fail_timeout=0;
# for TCP setups,point these to your backend servers
# server 192.168.0.7:8080 fail_timeout=0;
# server 192.168.0.8:8080 fail_timeout=0;
# server 192.168.0.9:8080 fail_timeout=0;
}
块中使用 least_conn
指令。因此,如果其中一只独角兽倒下,它将非常快速地回答,例如,500 错误。正因为如此,所有请求的 99% 将被发送到这个节点。换句话说,如果一个节点宕机 - 整个应用都宕机了。
我正在考虑尝试这样的事情:
upstream
根据 Nginx 文档 (http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_next_upstream),这意味着其中一台服务器将在接下来的 10 秒内被标记为 DOWN,它将在 10 秒内发送 5 个错误的答案。我没有看到任何缺陷。你怎么认为?我几乎找不到任何 fail_timeout 不是 0 的例子。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)