4 ms·
It would be nice to have a library for adding server/s to an upstream on the fly. Something like: nginx addserver upstream-name 127.0.0.1:8025 EDIT: Added ups
by ccarpenterg 14y ago
It would be nice to have a library for adding server/s to an upstream on the fly. Something like:
nginx addserver upstream-name 127.0.0.1:8025
EDIT: Added upstream name
- deleted 14y ago[deleted]
- druiid 14y agoThat is what puppet or a similar configuration management solution is for (or doing it by hand I suppose). There's not really a realistic scenario I can think of where you'd be wanting a built-in nginx function to service this requirement.
- conradev 14y agoFor those interested, the "application_nginx" cookbook for Chef does just this. It can configure upstream servers based on role very easily.
- druiid 14y agoIn puppet it's pretty easy as well. The puppet module modification I made to puppet-nginx allows you to do resource collection for a group of upstream servers (and thus add to a group of upstream locations transparently).
- justincormack 14y agoIf you really want to do it dynamically, you could read the upstreams from Redis with a combination of Nginx modules. Or use Puppet and restart, as the other poster suggested, as it won't break connections in progress.
- jvoorhis 14y agoStoring and reading the configuration from Redis will be slower at runtime, but should scale more easily for a large number of hosts and be much more responsive than using Puppet or Chef. I recommend choosing either solution based on the number of hosts and rate of change.
- jvoorhis 14y agoYou can also use a custom DNS resolver with Nginx, and point it to a tool like DNSMasq or PowerDNS [1]. [1] http://wiki.nginx.org/HttpCoreModule#resolver http://wiki.nginx.org/HttpCoreModule#resolver
- mattparlane 14y agoSee my comment about Hipache -- it pulls config from Redis on the fly.