以下片段将一次选择一个服务器.有没有办法立刻击中它们?
upstream backend {
server 17.0.0.1:8000;
server 17.0.0.1:8001;
server 17.0.0.1:8002;
server 17.0.0.1:8003;
}
server {
location / {
proxy_pass http://backend;
}
}
Run Code Online (Sandbox Code Playgroud)
这是使用ngx_http_mirror_module的解决方案(从 nginx 1.13.4 开始可用):
server {
location / {
proxy_pass http://17.0.0.1:8000;
mirror /s1;
mirror /s2;
mirror /s3;
}
location /s1 { internal; proxy_pass http://17.0.0.1:8001$request_uri; }
location /s2 { internal; proxy_pass http://17.0.0.1:8002$request_uri; }
location /s3 { internal; proxy_pass http://17.0.0.1:8003$request_uri; }
}
Run Code Online (Sandbox Code Playgroud)
nginx 将:
| 归档时间: |
|
| 查看次数: |
2006 次 |
| 最近记录: |