【问题标题】:Nginx as load balancer with 75% and 25% weighted routingNginx 作为负载均衡器,具有 75% 和 25% 加权路由
【发布时间】:2020-02-22 22:27:03
【问题描述】:

我是 Nginx 的新手。我有两台服务器 serverA 和 serverB。我想要一个 75% 的请求去 serverA,剩下 25% 的请求去 serverB。这可能吗?

【问题讨论】:

    标签: ubuntu nginx load-balancing ubuntu-18.04 nginx-reverse-proxy


    【解决方案1】:

    使用 nginx 加权路由:

    stream { 
        upstream stream_backend { 
            server srv1.example.com weight=75;
            server srv2.example.com weight=25; 
        } 
        server { 
            listen 80; 
            proxy_pass stream_backend; 
        } 
    }
    

    http://nginx.org/en/docs/http/load_balancing.html#nginx_weighted_load_balancing

    【讨论】:

    • @KarmveerSingh 我的回答有帮助吗?如果没有,请告诉我,我愿意提供帮助
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-11-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-04-28
    • 2023-01-13
    相关资源
    最近更新 更多