nginx-nginx_upstream_check_module主动健康检查模块

nginx版本nginx-1.20.2.tar.gz

wget https://github.com/yaoweibin/nginx_upstream_check_module/archive/refs/heads/master.zip

进入到nginx根目录

cd /datasdb/nginx-1.20.2/
yum install - patch

打补丁

patch -p1 < ../nginx_upstream_check_module-master/check_1.20.1+.patch
./configure --with-http_stub_status_module --add-module=/datasdb/nginx_upstream_check_module-master

注:这里我还用到了http_stub_status_module模块,所以一起打包编译

make

执行无损升级方案即可

conf配置:

upstream local_tomcat { 
		server 172.16.200.34:9101 max_fails=2 fail_timeout=1s;  
		server 172.16.200.39:9101 max_fails=2 fail_timeout=1s;  
       
        check interval=3000 rise=2 fall=3 timeout=1000 type=http;
        check_http_send "GET /index.jsp HTTP/1.0

";
        check_http_expect_alive  http_2xx http_3xx;
	}
location /tomcat_status {
  check_status;
  access_log   off;
}

最终效果:

经验分享 程序员 微信小程序 职场和发展