views:

96

answers:

1

I have a node in cloud environment which is used now as nginx and mongrels behind it.

This is what nginx config looks like:

upstream mongrel {
    server 127.0.0.1:8000;
    server 127.0.0.1:8001;
    server 127.0.0.1:8002;
}

I want to achieve the following:

  1. add another node
  2. nginx has to know about this new node automatically without stopping him, changing config(manually adding new node's mongrels) and starting it again.

How can I make my load balancer(nginx) work in the way so it can be self-aware of nodes in cloud?

+1  A: 

Create a script which writes the config file for you.

You can write a template config file where you replace the stuff you want to include automatically with some sort of placeholder, then you use a script which fetches your node list (from a database or something), creates the final config file and reloads the config in Ngnix.

Emil Vikström