• 负载均衡后端状态


    状态概述
    down 当前的server暂时不参与负载均衡
    backup 预留的备份服务器
    max_fails 允许请求失败的次数
    fail_timeout 经过max_fails失败后, 服务暂停时间
    max_conns 限制最大的接收连接数

    1.down状态配置测试

    [root@lb01 ~]# vim /etc/nginx/conf.d/zh.conf
    upstream zh {
        server 172.16.1.7:80 down;
        server 172.16.1.8:80;
    }
    server {
        listen 80;
        server_name linux.zh.com;
    
        location / {
            proxy_pass http://zh;
            include /etc/nginx/proxy_params;
        }
    }

    2.backup状态测试

    [root@lb01 ~]# vim /etc/nginx/conf.d/zh.conf
    upstream zh {
        server 172.16.1.7:80;
        server 172.16.1.8:80;
        server 172.16.1.10:80 backup;
        server 172.16.1.11:80 backup;
    
    }
    server {
        listen 80;
        server_name linux.zh.com;
    
        location / {
            proxy_pass http://zh;
            include /etc/nginx/proxy_params;
    
        }
    
    }

    3.max_fails配置

    [root@lb01 ~]# vim /etc/nginx/conf.d/zh.conf
    upstream zh {
        server 172.16.1.7:80 max_fails=3 fail_timeout=10s;
        server 172.16.1.8:80;
    
    }
    server {
        listen 80;
        server_name linux.zh.com;
    
        location / {
            proxy_pass http://zh;
            include /etc/nginx/proxy_params;
    
        }
    
    }

    4.测试max_conns最大TCP连接数

    [root@lb01 ~]# vim /etc/nginx/conf.d/zh.conf
    upstream zh {
        server 172.16.1.7:80 max_conns=10;
        server 172.16.1.8:80;
    
    }
    server {
        listen 80;
        server_name linux.zh.com;
    
        location / {
            proxy_pass http://zh;
            include /etc/nginx/proxy_params;
    
        }
    
    }
  • 相关阅读:
    windows下mysql多实例安装
    linux下mysql多实例安装
    redisAPI整理
    Flink
    Google Dremel架构
    Apache Kylin
    Phoenix概述
    SQL on Hadoop技术综述
    AES对称加密算法
    Hawq架构
  • 原文地址:https://www.cnblogs.com/chenlifan/p/13596100.html
Copyright © 2020-2023  润新知