zoukankan      html  css  js  c++  java
  • nginx中的upstream使用

    upstream的基本使用

    upstream admin{
    server 127.0.0.1:9090 down;
    server 127.0.0.1:8080 weight=2;
    server 127.0.0.1:6060;
    server 127.0.0.1:7070 backup
    }

    在需要使用负载均衡的server中增加
    proxy_pass http://admin/;

    每个设备的状态设置为:
    1、down表示当前的server暂时不参与负载
    2、weight 默认为1.weight越大,负载的权重就越大,那么该服务器被访问到的几率就越大
    3、max_fails :允许请求失败的次数默认为1.当超过最大次数时,返回proxy_next_upstream 模块定义的错误
    4、fail_timeout:max_fails次失败后,暂停的时间。
    5、backup: 其它所有的非backup机器down或者忙的时候,请求backup机器。所以这台机器压力会最轻。

    例子:
    server 192.168.1.11 max_fails=3 fail_timeout=30s; 这表示,如果服务器192.168.1.11在30秒内出现了3次错误,那么就认为这个服务器工作不正常,从而在接下来的30秒内nginx不再去访问这个服务器。

    参考;

    https://blog.csdn.net/a12345678n/article/details/80179910

  • 相关阅读:
    BZOJ 3529 数表
    BZOJ 3832 Rally
    BZOJ 1086 王室联邦
    BZOJ 2738 矩阵乘法
    2656565
    小L的区间求和
    小L的直线
    Co-prime 杭电4135
    POJ 跳蚤
    B
  • 原文地址:https://www.cnblogs.com/sea-stream/p/11361477.html
Copyright © 2011-2022 走看看