答案1
“某物”需要成为负载均衡器 - HAProxy 可以完成这项工作。您只需添加“服务器 1”和“服务器 2”,然后检查第一个服务器是否无法正常工作,然后将您的流量移至备份。以下是 HAProxy 配置示例:
frontend web
bind :80
option httplog
option forwardfor except 127.0.0.1
option forwardfor header X-Real-IP
acl is-correct-address hdr_dom(host) -i something.server.dns.address
acl is-production-offline nbsrv(production) lt 1
use_backend backup if is-correct-address is-production-offline
use_backend production if is-correct-address
backend production
mode http
server server-1 10.0.0.1:80
backend backup
mode http
server server-2 10.0.0.2:80