Nginx 在用于负载平衡时不会发生故障转移
我们使用 Nginx 在两个上游应用程序服务器之间进行负载平衡,我们希望在部署到其中一个服务器时能够将其关闭。我们发现,当我们关闭其中一个时,Nginx 不会将故障转移到另一个。它不断发送请求并记录错误。
我们的上游指令具有以下形式:
upstream app_servers {
server 10.100.100.100:8080;
server 10.100.100.200:8080;
}
通过阅读 Nginx 文档,我们了解到我们不需要显式指定“max_fails”或“fail_timeout”,因为它们具有合理的默认值。 (即 max_fails 为 1)。
知道我们在这里可能会错过什么吗?
非常感谢。
We're using Nginx to load balance between two upstream app servers and we'd like to be able to take one or the other down when we deploy to it. We're finding that when we shut one down, Nginx is not failing over to the other. It keeps sending requests and logging errors.
Our upstream directive has the form:
upstream app_servers {
server 10.100.100.100:8080;
server 10.100.100.200:8080;
}
Our understanding from reading the Nginx docs is that we don't need to explictly specify the "max_fails" or "fail_timeout" because they have reasonable defaults. (ie. max_fails of 1).
Any idea what we might be missing here?
Thanks much.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据文档...
根据文档,失败由 proxy_next_upstream 或 fastcgi_next_upstream。
请检查日志记录了哪些类型的错误,如果不是默认值(错误或超时),那么您可能需要在 proxy_next_upstream 或 fastcgi_next_upstream 中专门定义它。
As per the documentation...
As per the documentation, a failure is define by proxy_next_upstream or fastcgi_next_upstream.
Please check the log what type of errors were logged, if it is not the default (error or timeout), then you may want to define it exclusively in proxy_next_upstream or fastcgi_next_upstream.