# Load balancer - add nodes dynamically to upstream

**URL:** <https://www.ruby-forum.com/t/load-balancer-add-nodes-dynamically-to-upstream/209855>\
**Category:** NGINX\
**Created:** [July 24, 2011, 7:52pm UTC](https://www.ruby-forum.com/t/load-balancer-add-nodes-dynamically-to-upstream/209855 "2011-07-24T19:52:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [July 24, 2011, 7:52pm UTC](https://www.ruby-forum.com/t/load-balancer-add-nodes-dynamically-to-upstream/209855/1 "2011-07-24T19:52:13Z")

</div>

For a particular use case, we are using nginx as a lb (with 'weight’s  
and 'fail\_timeout’s as mentioned in the wiki here -

> **[Use NGINX as a Front-end Proxy and Software Load Balancer](https://www.linode.com/docs/guides/use-nginx-as-a-front-end-proxy-and-software-load-balancer/)**
>
> NGINX web server can function as a capable load balancer in addition to serving static and dynamic content. This guide shows how to use it as a front-end proxy as well.

.  
[http://library.linode.com/web-servers/nginx/configuration/front-end-proxy-and-software-load-balancing#sph\_software-load-balancing](http://library.linode.com/web-servers/nginx/configuration/front-end-proxy-and-software-load-balancing#sph_software-load-balancing))

This works great, but we want to add nodes to the lb dynamically ( i.e.  
change the ‘server’ entries, by adding a new entry or delete stale  
entries altogether).

On quick glance, there is a http upstream module here, -  
[Module ngx\_http\_upstream\_module](http://wiki.nginx.org/NginxHttpUpstreamModule) , that discusses those  
options used in the lb application.

- Is there an api to add server entries / delete entries managed by the  
upstream module dynamically ?

- If the answer to the previous question is no, then can we  
\*\* patch upstream module to provide so or  
\*\* start writing a separate module similar to ‘upstream’ , that will  
provide the api to do so ?

Any other suggestions for dynamically managing the list of servers in  
upstream. Thanks.

---

<div class="post-metadata">

**Author:** ![Renjith\_T](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/977dab/32.png) [@Renjith\_T](https://www.ruby-forum.com/u/Renjith_T)\
**Post date:** [July 25, 2011, 6:34am UTC](https://www.ruby-forum.com/t/load-balancer-add-nodes-dynamically-to-upstream/209855/2 "2011-07-25T06:34:02Z")

</div>

You can modify the config and perform a server reload, thats how I do  
it.

---

<div class="post-metadata">

**Author:** ![Renjith\_T](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/977dab/32.png) [@Renjith\_T](https://www.ruby-forum.com/u/Renjith_T)\
**Post date:** [July 25, 2011, 6:35am UTC](https://www.ruby-forum.com/t/load-balancer-add-nodes-dynamically-to-upstream/209855/3 "2011-07-25T06:35:17Z")

</div>

Of course Im refering to writing a script to do so.

---

<div class="post-metadata">

**Author:** ![Renjith\_T](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/977dab/32.png) [@Renjith\_T](https://www.ruby-forum.com/u/Renjith_T)\
**Post date:** [March 9, 2012, 12:38am UTC](https://www.ruby-forum.com/t/load-balancer-add-nodes-dynamically-to-upstream/209855/4 "2012-03-09T00:38:32Z")

</div>

Is there any news on dynamically adding / removing upstreams?

Posted at Nginx Forum:

> **[Re: load balancer - add nodes dynamically to upstream](https://forum.nginx.org/read.php?2,212899,223653#msg-223653)**
>
> For a particular use case, we are using nginx as a lb (with 'weight's and 'fail\_timeout's as mentioned in the wiki here -...
