Load balancer on nginx : how to monitoring backend?

Hello everyone,

I use nginx 1.8.0 on debian (official nginx package with nginx repo)

I created a reverse proxy SSL cluster with load balancing. Everything
works fine.


upstream myapp {
server srv1;
server srv2;
}


location ~ ^/myapp {
rewrite ^/(.*) /$1 break;
proxy_pass http://myapp;
}

However I wish to monitor the status of the backend. How can I do ?

Thank you.

compiler option

built by gcc 4.9.2 (Debian 4.9.2-10)
built with OpenSSL 1.0.1k 8 Jan 2015
TLS SNI support enabled
configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx
–conf-path=/etc/nginx/nginx.conf
–error-log-path=/var/log/nginx/error.log
–http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid
–lock-path=/var/run/nginx.lock
–http-client-body-temp-path=/var/cache/nginx/client_temp
–http-proxy-temp-path=/var/cache/nginx/proxy_temp
–http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp
–http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp
–http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx
–group=nginx --with-http_ssl_module --with-http_realip_module
–with-http_addition_module --with-http_sub_module
–with-http_dav_module --with-http_flv_module --with-http_mp4_module
–with-http_gunzip_module --with-http_gzip_static_module
–with-http_random_index_module --with-http_secure_link_module
–with-http_stub_status_module --with-http_auth_request_module
–with-mail --with-mail_ssl_module --with-file-aio
–with-http_spdy_module --with-cc-opt=‘-g -O2 -fstack-protector-strong
-Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2’
–with-ld-opt=‘-Wl,-z,relro -Wl,–as-needed’ --with-ipv6

Hello!

On Wed, Jan 27, 2016 at 9:10 AM, Alexandre wrote:

However I wish to monitor the status of the backend. How can I do ?

You may find the lua-resty-upstream-healthcheck library helpful:

https://github.com/openresty/lua-resty-upstream-healthcheck

But it’s much easier to install via the OpenResty bundle though:

https://openresty.org/

Regards,
-agentzh

Monitoring of backend seems to be possible with NGINX PLUS. Can you
confirm ?

http://nginx.org/en/docs/http/ngx_http_upstream_module.html
https://www.nginx.com/products/

Thank you

Alexande.

Hello, thank you I’ll test.

It is not possible to test the nginx upstream directly ?

Thank you

Alexandre

On 1/28/16 1:32 AM, Alexandre wrote:

Monitoring of backend seems to be possible with NGINX PLUS. Can you
confirm ?

Module ngx_http_upstream_module
NGINX Application Platform | NGINX

Yes, that’s right.


nginx mailing list
[email protected]
nginx Info Page


Maxim K.

Hi.

Am 28-01-2016 08:36, schrieb Alexandre:

Yes, that’s right.

OK, I can not use a load balancer in production without backend
monitoring. I will use LVS.

just for my curiosity why can’t buying n+, for production!?

BR Aleks

Hello,

On 28/01/16 08:27, Maxim K. wrote:

On 1/28/16 1:32 AM, Alexandre wrote:

Monitoring of backend seems to be possible with NGINX PLUS. Can you
confirm ?

Module ngx_http_upstream_module
NGINX Application Platform | NGINX

Yes, that’s right.

OK, I can not use a load balancer in production without backend
monitoring. I will use LVS.

Thank you.

Alexandre.

Does anyone know if the author still maintains
nginx_upstream_check_module?
I see only a handful of commits in the past year and they all look like
contributed changes.

On Thu, Jan 28, 2016 at 9:28 PM, Dewangga Bachrul Alam <

Hello

On 28/01/16 22:26, Aleksandar L. wrote:

Module ngx_http_upstream_module
NGINX Application Platform | NGINX

Yes, that’s right.

OK, I can not use a load balancer in production without backend
monitoring. I will use LVS.

just for my curiosity why can’t buying n+, for production!?

First I do not know the price of nginx plus. Moreover I do not think
it’s a good idea to use a reverse proxy TLS and load balancing on the
same machine when there is high web traffic. I preferred to separate
processes. Nginx for reverse proxy TLS and LVS + Varnish for load
balancing and cache.

BR Aleks

Regards,
Alexandre.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Hello!

If you are in development, you can try this module
GitHub - yaoweibin/nginx_upstream_check_module: Health checks upstreams for nginx. But, not
recommended if use on production, better use n+.

On 01/28/2016 02:36 PM, Alexandre wrote:

Yes, that’s right.

You may find the lua-resty-upstream-healthcheck library
helpful:

GitHub - openresty/lua-resty-upstream-healthcheck: Health Checker for Nginx Upstream Servers in Pure Lua

But it’s much easier to install via the OpenResty bundle though:

_______________________________________________ nginx mailing
_______________________________________________ nginx mailing list
[email protected] nginx Info Page
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCAAGBQJWqs5DAAoJEOV/0iCgKM1wIAcP/inWjW0CGSQ1R0zDkwi+j5Ac
m3LVzIS86/Ft86BuJXcam3SC5Cf+1bCYM0rUsYx5xsTZMjnJhOOkLaPFSGJ4jwth
E3Lu5qDckCttOdmndmWXPUWHdTLASJXjntLEQgY969h48ucJRoCmA3ZB9DsPql7e
nJS4Rkcu9DV4bSiCB6gFMNUksI9em/G6N/P2kXkEl33I9wEi79O7y5sT16dXiGm0
vTp5qozO2UtGtO6lfx3s0xYxUpsSiLYtYlfAY6335cuh1yFQqhMyNr2EgphtlY+1
cMMQnlM8Sfut0YltRcV3YSq1d8je4QEXSK0mC8sSXJUE58V/C6otu/O1I/h1BnQO
g0TKFDTQk1rN1/z3b9jirlObwdNbWmIq7hI9Nuwi3WilDB57iEoD+pmC7R2obKDS
ItrkkAKWWTsDyQOH2BMCK4nqW+whHC7D3lFCrKuzsITJDrFJf6fjzlXRzniwH/1L
VJgKaIlnX7M54zJwITZcDcYGmLuC/MRHNU9HK3QYDgwdPdgSccDQwlhBnxI7tNtS
gSaEVpf9Af/8QIPPyLngvl6uGskvfQdXiWHmRb0SyTwZcJEDrutf6q//hwT59Mn4
ZFLS7htPV8wCKvgxlFV7DtxRcbm9HBDRdt1ScrbTKQbLAxxQhpOVCV1emhFjfgem
020FGHFbMMmngyi50b1p
=XA04
-----END PGP SIGNATURE-----