Lua/Redis Routing with Failover

Rick Richardson rick.richardson at
Wed Feb 1 17:02:41 UTC 2012

So in my conf I would have:

upstream myroutes {

location / {
  access_by_lua '
     Fetch a list of peers with failover info from redis and then populate
the lua_redis_route upstream peer array with that data

The idea is simply that I would fetch a current list of peers from redis
and plug them in to nginx's existing upstream. This would allow me to
elegantly handle failure by failing over to the next peer on the list and
then report that peer as 'down' back to redis.
On Feb 1, 2012 11:05 AM, "Rick Richardson" <rick.richardson at>

> Sorry for the confusion. I don't want failover/backup for redis servers, I
> want the redis request to return multiple upstreams that I can proxy to
> with proxy_pass.
> E.g. I get a request for I ask redis for a list of upstream
> servers to which I can serve  I then feed the entire list somehow
> into proxy_pass.  It then performs its normal htttp_upstream operation as
> if it had a standard list of peers in an upstream.
> On Jan 31, 2012 11:25 PM, "agentzh" <agentzh at> wrote:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx-devel mailing list