Viren Pushpanayagam
Viren Pushpanayagam

Reputation: 2497

NGINX load balancer and deployments

My website depends on server affinity. My setup has 2 nodes (A and B) serving client request.

Just before a deployment I want the NGINX load balancer to stop sending new requests to node B but all request that already have an affinity to node B be should be send to node B.

Is this possible with NGINX?

Upvotes: 2

Views: 622

Answers (2)

Nick Kotenberg
Nick Kotenberg

Reputation: 934

You can use server "someserverip" down; This is how we do it and it works great! It allows current requests to finish and then all new requests to go other servers. Then you deploy to that server and remove "down".

Upvotes: 0

Like @mikhailov told me in the comments, current requests will be finished, although the server is removed from the configuration. So here is the tactics:

  • Remove the server (which will be under deployment) from the configuration
  • Reload the nginx configuration

When the deployment has finished:

  • Add the server to the configuration again
  • Reload the nginx configuration

Upvotes: 1

Related Questions