首页 > 其他 > 详细

负载均衡常见错误

时间:2020-09-01 16:33:33      阅读:56      评论:0      收藏:0      [点我收藏+]

 

1)错误

如果后端服务器返回报错,负载均衡仍然会将请求分配到出错的web服务器,
因为负载均衡只会根据调度算法将请求分配到后端,不会进行判断后端是否正常

 

2)解决错误的模块语法

Syntax:    proxy_next_upstream error | timeout | invalid_header | http_500 | http_502 | http_503 | http_504 | http_403 | http_404 | http_429 | non_idempotent | off ...;
Default:    proxy_next_upstream error timeout;
Context:    http, server, location

 

3)配置方法

[root@lb01 ~]# vim /etc/nginx/conf.d/zh.conf 
upstream zh {
    server 172.16.1.7:80;
    server 172.16.1.9:80;
}

server {
    listen 80;
    server_name linux.zh.com;

    location / {
        proxy_pass http://zh;
        include /etc/nginx/proxy_params;
        proxy_next_upstream http_502 error timeout;
    }
}

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  

负载均衡常见错误

原文:https://www.cnblogs.com/chenlifan/p/13596752.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!