負載均衡常見錯誤


 

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; } }

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM