nginx負載均衡策略url_hash配置方法


參考文章:

https://docs.nginx.com/nginx/admin-guide/load-balancer/http-load-balancer/
根據路徑,進行一致性hash,具體的配置方法

upstream backend {
    hash $request_uri consistent;
    server backend1.example.com;
    server backend2.example.com;
}

需要注意的是:順序不能錯,否則會報錯

nginx: [warn] load balancing method redefined in /etc/nginx/conf.d/upstream.conf:5

https://ma.ttias.be/nginx-nginx-warn-load-balancing-method-redefined/


免責聲明!

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



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