Welcome! Log In Create A New Profile

Advanced

Re: ip_hash and multiple clients on the same host

Sergey A. Osokin
October 30, 2020 04:48PM
On Fri, Oct 30, 2020 at 11:29:39AM -0400, bobfang_sqp wrote:
> Hi I am using nginx as a load balacer and I require sticky session (same
> client always go to the same server), for this purpose I use this following
> setup:
>
>
> upstream backend {
> ip_hash;
> server host1:8000;
> server host2:8000;
> }
>
> The `ip_hash` directive is what I learned from online docs, but I am just
> wondering does this mean that all the requests from the same host will be
> routed to the same upstream server? Since I may have multiple clients
> running on the same host, I want to still distribute these requests to
> different upstream servers but if I am using ip_hash does that imply if two
> clients are on the same host they will be routed to the same server because
> they share the same ip? There seems to be some more advanced configs to
> achieve sticky session but seems that would require nginx plus which I dont
> have... My intention is that even if two clients come from same host they
> should probably go to different server, but after they are assigned an
> upstream server they should stick to that one. Thanks!

Hi,

a couple of options in this case:
- sticky session feature is available as part of commecial subscription with
NGINX Plus;
- NGINX Sticky module for NGINX OSS is available in GH, here's the link to
one of the forks, https://github.com/ayty-adrianomartins/nginx-sticky-module-ng

--
Sergey
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

ip_hash and multiple clients on the same host

bobfang_sqp October 30, 2020 11:29AM

Re: ip_hash and multiple clients on the same host

Sergey A. Osokin October 30, 2020 04:48PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 281
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready