nginx-sticky-module-ng + nginx_upstream_check_module Not Working

Issue #24 new
Pat Synor created an issue

I opened this as a new issue because I saw that there is one for an issue related to these modules, but that report describes issues compiling. I am able to install successfully but I have an issue with my testing. My test consists of me establishing a session and verifying I am getting the route cookie and verifying the logs indicate that the sticky module is checking that cookie.

I then forced a failure on the health check of the only available upstream, and I could see in the status page for the nginx_upstream_check_module that the upstream was being marked as down, however I was still able to get to the upstream via NGINX and the logs indicated it was checking my route cookie and routing me to the upstream.

In short, even with no available upstreams with the nginx_upstream_check_module, nginx-sticky-module-ng is still sending me to the upstream that should be "down".

I am using the latest version of nginx-sticky-module-ng, the latest version of nginx_upstream_check_module from https://github.com/yaoweibin/nginx_upstream_check_module, and NGINX 1.9.9.

The installation procedure I followed was the following:

  1. Download the components listed above.
  2. Patch nginx_upstream_check_module with the check_1.9.2+.patch according to the dev's instructions using:

patch -p0 < /usr/src/nginx_upstream_check_module-master/check_1.9.2+.patch

  1. Patch nginx-sticky-module-ng with:

patch -p1 < patches/upstream_check.patch

  1. Configure nginx 1.9.9 with:

./configure --user=nginx --group=nginx --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --with-http_gzip_static_module --with-http_stub_status_module --with-http_ssl_module --with-pcre --with-file-aio --with-http_realip_module --without-http_scgi_module --without-http_uwsgi_module --without-http_fastcgi_module --add-module=/usr/src/nginx-sticky-module-ng --add-module=/usr/src/nginx_upstream_check_module-master

  1. Compile and install NGINX.

Comments (6)

  1. Pat Synor reporter

    Looks like JIRA changed the numbers I entered for the steps, so ignore whats presented. They are just sequential...

  2. Jonathan Huot

    Both modules are working correctly for me. Tested with latest versions: nginx 1.12.0 nginx_upstream_check_module @ 2bbab54 nginx-sticky-module-ng @ 08a395c

    Two patches were applied:

    nginx was patched with upstream_check's check_1.11.5+.patch sticky-module-ng was patched with upstream_check's nginx-sticky-module.patch I tried to reproduce what you described above, but for me, it's working as expected, I was never able to reach a "sick" server. When all servers were down, I got a 504 from nginx itself.

  3. jahun

    tnx for reply, so i tested same setup:

    tested

    • nginx 1.12.0
    • nginx-sticky-module-ng @08a395c
    • nginx-sticky-module-ng @0.3.0-10-gf3bdb7b http_upstream_check-nginx-1.11.5+.patch

    = https://github.com/gentoo/gentoo/blob/master/www-servers/nginx/nginx-1.12.0.ebuild

    result

    • server is correctly marked down in check_status location
    • when i was routed to sick server, i always get 503, and never been rerouted to good server

    = same error result.

    upstream cfg:

    upstream upstream-app {
            # nginx-sticky-module-ng
            sticky name=SRV hash=index path=/;
    
            # nginx_http_upstream_check_module
            check interval=10000 rise=1 fall=2 timeout=2000 type=http default_down=false;
            check_http_send "GET /monitor.jsp HTTP/1.0\r\n\r\n";
            check_http_expect_alive http_2xx;
    
            # each worker
            keepalive 16;
    
            server app1 weight=100;
            server app2 weight=100;
            server app3 weight=25;
            server app4 weight=200;
    
    }
    

    nginx -V

    nginx version: nginx/1.12.0
    built with OpenSSL 1.0.2k  26 Jan 2017
    TLS SNI support enabled
    configure arguments: --prefix=/usr --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error_log --pid-path=/run/nginx.pid --lock-path=/run/lock/nginx.lock --with-cc-opt=-I/usr/include --with-ld-opt=-L/usr/lib64 --http-log-path=/var/log/nginx/access_log --http-client-body-temp-path=/var/lib/nginx/tmp/client --http-proxy-temp-path=/var/lib/nginx/tmp/proxy --http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi --http-scgi-temp-path=/var/lib/nginx/tmp/scgi --http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi --with-compat --with-file-aio --with-http_v2_module --with-pcre --with-pcre-jit --with-threads --without-http_autoindex_module --without-http_fastcgi_module --without-http_memcached_module --without-http_scgi_module --without-http_ssi_module --without-http_split_clients_module --without-http_upstream_hash_module --without-http_upstream_least_conn_module --without-http_upstream_zone_module --without-http_userid_module --without-http_uwsgi_module --with-http_gzip_static_module --with-http_realip_module --with-http_stub_status_module --add-module=external_module/ngx_cache_purge-2.3 --add-module=external_module/nginx_upstream_check_module-f3bdb7b85a194e2ad58e3c306c1d021ee76da2f5 --add-module=external_module/nginx-goodies-nginx-sticky-module-ng-08a395c66e42 --with-http_ssl_module --without-stream_access_module --without-stream_geo_module --without-stream_limit_conn_module --without-stream_map_module --without-stream_return_module --without-stream_split_clients_module --without-stream_upstream_hash_module --without-stream_upstream_least_conn_module --without-stream_upstream_zone_module --without-mail_imap_module --without-mail_pop3_module --without-mail_smtp_module --user=nginx --group=nginx
    
  4. Jonathan Huot

    Have you forget to add the line below in your configuration ?

      check interval=5000 rise=1 fall=3 timeout=4000 type=http;
    
  5. jahun

    sorry, just forget to paste here. it was used in tests:

           check interval=10000 rise=1 fall=2 timeout=2000 type=http default_down=false;
    
  6. Log in to comment