ICode9

精准搜索请尝试: 精确搜索
首页 > 系统相关> 文章详细

nginx nginx_upstream_check_module-master 自动踢除

2019-09-09 11:01:05  阅读:273  来源: 互联网

标签:1.14 http module nginx upstream check


nginx 1.14.0

描述:

nginx自带的upstream配置,如果后端挂了,接口会慢,原因不讲述,故接入第三方的自动检测与自动踢除模式

nginx_upstream_check_module模块:

*** 下载地址https://github.com/yaoweibin/nginx_upstream_check_module ***


 wget 'http://nginx.org/download/nginx-1.14.0.tar.gz'
 tar -xzvf nginx-1.14.0.tar.gz
 cd nginx-1.14.0/
 patch -p1 < /path/to/nginx_http_upstream_check_module/check_1.14.0+.patch


#./configure --prefix=/usr/local/nginx --user=www --group=www --with-http_stub_status_module --with-http_v2_module --with-http_ssl_module --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-http_mp4_module --with-openssl=/opt/tools/openssl-1.0.2l/ --with-pcre-jit --with-ld-opt=-ljemalloc --with-debug --add-module=/opt/tools/nginx-module-vts-master/ --add-module=/opt/tools/nginx_upstream_check_module-master/ --add-module=/opt/tools/ngx_cache_purge-2.3/

#make

#mv objs/nginx /usr/local/nginx/sbin/nginx
#nginx -s reload

nginx配置例子

    http {

        upstream cluster {

            # simple round-robin
            server 192.168.0.1:80;
            server 192.168.0.2:80;

            check interval=5000 rise=1 fall=3 timeout=4000;

            #check interval=3000 rise=2 fall=5 timeout=1000 type=ssl_hello;

            #check interval=3000 rise=2 fall=5 timeout=1000 type=http;
            #check_http_send "HEAD / HTTP/1.0\r\n\r\n";
            #check_http_expect_alive http_2xx http_3xx;
        }

        server {
            listen 80;

            location / {
                proxy_pass http://cluster;
            }

            location /status {
                check_status;

                access_log   off;
                allow SOME.IP.ADD.RESS;
                deny all;
           }
        }

    }

curl http://qing.xxxx/check_status?format=json

标签:1.14,http,module,nginx,upstream,check
来源: https://www.cnblogs.com/Qing-840/p/11490456.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有