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;
    
        }
    
    }
  • 相关阅读:
    内存
    TCP/IP
    安装
    linux常用命令
    linux文本处理三剑客之 grep
    tail命令:显示文件结尾的内容
    less命令:查看文件内容
    head命令:显示文件开头内容
    改进Zhang Suen细化算法的C#实现
    【转】在VS2010上使用C#调用非托管C++生成的DLL文件(图文讲解)
  • 原文地址:https://www.cnblogs.com/chenlifan/p/13596100.html
Copyright © 2011-2022 走看看