zoukankan      html  css  js  c++  java
  • 负载均衡后端状态

    状态概述
    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;
    
        }
    
    }
  • 相关阅读:
    Java 代理模式
    ReentrantLock 详解
    Java线程池详解
    ConcurrentHashMap 解读
    CountDownLatch/CyclicBarrie用法记录
    微信接入笔记记录
    iOS设计模式
    iOS设计模式
    iOS设计模式
    iOS设计模式
  • 原文地址:https://www.cnblogs.com/chenlifan/p/13596100.html
Copyright © 2011-2022 走看看