With the growth of business, more and more back-end nodes of the load balancer on nginx are deployed, and the running status of the back-end nodes needs to be monitored. Therefore, Ali's health detection module nginx_upstream_check_module is introduced, which can be used to detect the real server's back-end realserver. health status.
1. Download
1、nginx
http://nginx.org/download/nginx-1.9.2.tar.gz
2、nginx_upstream_check_module
http://github.com/yaoweibin/nginx_upstream_check_module
2. Installation configuration
1. File list information
[root@iZ233438q9fZ upload]# ll drwxr-xr-x 6 ftpuser ftp 4096 Aug 19 10:04 nginx_upstream_check_module drwxr-xr-x 8 1001 1001 4096 Jun 16 2015 nginx-1.9.2.tar.gz2. Decompression
[root@iZ233438q9fZ upload]# tar -zxvf nginx-1.9.2.tar.gz [root@iZ233438q9fZ upload]# cd nginx-1.9.2
3. nginx patch installation
[root@iZ233438q9fZ nginx-1.9.2]# patch -p0 < /var/ftp/upload/nginx_upstream_check_module/check_1.9.2+.patch patching file src/http/modules/ngx_http_upstream_hash_module.c patching file src/http/modules/ngx_http_upstream_ip_hash_module.c patching file src/http/modules/ngx_http_upstream_least_conn_module.c patching file src/http/ngx_http_upstream_round_robin.c patching file src/http/ngx_http_upstream_round_robin.h
4. Compile and configure
[root@iZ233438q9fZ nginx-1.9.2]# ./configure --add-module=/var/ftp/upload/nginx_upstream_check_module --prefix=/usr/local/server/nginx [root@iZ233438q9fZ nginx-1.9.2]# make && make install
3. nginx.conf health check configuration example
Parameter Description:
- check_status: [html|csv|json], default html
- check_http_send: Specify the detected http access address, default /
- type:[tcp|http|ssl_hello|mysql|ajp],默认tcp
- interval: interval for sending health check packets to the backend, in milliseconds
- fall(fall_count): If the number of consecutive failures reaches fall_count, the server is considered down.
- rise(rise_count): The server is considered up if the number of consecutive successes reaches the rise_count.
- timeout: The timeout for the backend health request.
PS: If it keeps showing failure, please check if there is index.jsp or index.html in the project root directory