Nginx作为负载均衡器,具有75%和25%的加权路由 [英] Nginx as load balancer with 75% and 25% weighted routing
本文介绍了Nginx作为负载均衡器,具有75%和25%的加权路由的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是Nginx的新手.我有两个服务器serverA和serverB.我希望有75%的请求转到serverA,其余25%的请求转到serverB.这可能吗?
I am new to Nginx. I have two servers serverA and serverB. I want a 75% request to go to serverA and rest 25% requests to serverB. Is this possible?
推荐答案
使用nginx加权路由:
use nginx weighted routing:
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
这篇关于Nginx作为负载均衡器,具有75%和25%的加权路由的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文