【发布时间】:2019-02-09 20:37:16
【问题描述】:
我在不同的大陆(美国和欧洲)有 2 个不同的上游
我希望每个服务器始终将流量发送到同一台服务器,但是我需要在每个服务器上指定 2 台服务器以防停机 - 流量应发送到备用服务器。
问题在于没有执行此操作的策略。我在首选服务器上做了 weight=1000000000 的解决方法,但我觉得这不是正确的方法。
upstream US_UPSTREAM {
ip_hash;
server 2.2.2.2 weight=100000000 max_fails=10 fail_timeout=3600s;
server 1.1.1.1 #should only be used as backup, not round robin or any other strategy
}
upstream EU_UPSTREAM {
ip_hash;
server 1.1.1.1 weight=100000000 max_fails=10 fail_timeout=3600s;
server 2.2.2.2 #should only be used as backup, not round robin or any other strategy
}
【问题讨论】:
-
你试过
backup选项吗? -
是的,就是这样!谢谢
标签: nginx nginx-location nginx-reverse-proxy