1.集群配置
upstream co_name{
server 127.0.0.1;
server 127.0.0.2;
}
location{
proxy_pass co_name
}
2.请求超时配置
proxy_read_timeout 3s #默认60秒
3.故障转移
proxy_next_upstream error timeout #配置故障类型
注意幂等接口
4.雪崩及应对方案
proxy_next_upstream_tries #重试次数
proxy_next_upstream_timeout #重试时长
5.熔断机制
max_fails #错误多少次就熔断
fail_timeout #熔断时长,访问一次,正确就正常访问,错误就继续熔断