How can I dynamically reconfigure upstream servers on nginx OSS?

Viewed 2297

I have multiple upstream servers from an nginx load balancer:

upstream app {
  # Make each client IP address stick to the same server
  # See http://nginx.org/en/docs/http/load_balancing.html
  ip_hash;

  # Use IP addresses: see recommendation at https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/
  server 1.1.1.1:6666; # app-server-a
  server 2.2.2.2:6666; # app-server-a
}

Right now I ue the servers in an active/passove configuration by taking down each servers (eg systemctl myapp stop) then letting nginx detect the server is down.

However I'd like to be able to change the upstream server dyamically, without having to take either app server or nginx OSS down. I'm aware of the proprietary upstream_conf module for nginx Plus but am using nginx OSS.

How can I dynamically dynamically reconfigure the upstream server on nginx OSS?

1 Answers
Related