记录NGINX负载重试的可用性问题

NGINX负载配置max_fails和fail_timeout使用问题:

总体配置的情况如下:

server {
    listen       8090;
    server_name  localhost:8090;

    location / {
		proxy_pass http://springboot;
		proxy_read_timeout 30;
	}
}
upstream springboot {
	server localhost:8080 max_fails=1 fail_timeout=60s;
	server localhost:8081 max_fails=1 fail_timeout=60s;
	server localhost:8082 max_fails=1 fail_timeout=60s;
}


问题描述:

当前是服务服务返回的状态码是:500,那我们就需要增加判断哪些情况下是失效的:因此增加:

proxy_next_upstream error timeout http_500

不生效,目前后端返回500的状态,不能完成max_fails的,负载到下一台的效果

NGINX的proxy_next_upstream文档资料


原因分析:

我也不知道啥原因,


解决方案:

non_idempotent normally, requests with a non-idempotent method (POST, LOCK, PATCH) are not passed to the next server if a request has been sent to an upstream server (1.9.13); enabling this option explicitly allows retrying such requests;

proxy_next_upstream error timeout http_500 non_idempotent

增加了non_idempotent就可以了,目前是高版本支持。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值