upstream 负载均衡 各类参数

这里写自定义目录标题

只能配合反向代理使用,配置在http段。

upstream upservers {
   server 192.168.126.144 max_fails=1 fail_timeout=36 ;
   server 192.168.8.100:8080 max_fails=1 fail_timeout=36 ;

}

backup :备用节点,所有节点坏了 才正式启用

max_fails : 健康状态监测
fail_timeout=time
weight :权重

down 和 ip_hash 配合使用,下线服务器,不可访问。

health_check 用在location中配合 负载均衡组使用。

可以不带参数,全部使用默认。
可选的参数:interval=time(多长时间检查一次) fails=number(失败几次)passes=number(通过几次,认为是ok的)
uri=uri (要请求的资源) match=name (2xx 3xx,)

例子:location / {
proxy_pass http://backend;
health_check match=welcome;
}
match welcome {

    status 200;
    header content-type = text/html;
    body ~"welcome to nginx";

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值