subrequest failover

James Lyons james.lyons at gmail.com
Wed Sep 15 05:02:20 MSD 2010


so lets say I have a config that looks like:
upstream somename {
                server www.somename1.net:80;
                server www.somename2.net:80;
                server www.somename3.net:80;
}

location /data/ {
...
proxy_pass http://somename/data/;
}
-------------
These names are processed as round robin I assume, but if a connection
to one fails -- it won't retry elsewhere.
To get that, i need to specify backup like in the example below.  But
can I similarly specify multiple backups and have those load balanced
as well?
--------------
upstream somename {
                server www.somename1.net:80;
                server www.somename2.net:80;
                server www.somename3.net:80;
                server www.backupname1.net:80 backup;
                server www.backupname2.net:80 backup;
                server www.backupname3.net:80 backup;
}

location /data/ {
...
proxy_pass http://somename/data/;
...
}

On Wed, Jul 28, 2010 at 6:40 PM, Denis F. Latypoff <latypoff at yandex.ru> wrote:
> 29.07.2010, 04:36, "James Lyons" <james.lyons at gmail.com>:
>> I am trying to use nginx as reverse proxy to perform failover from 1
>> critical service to another.
>>
>> When processing a request, it sends a request (http GET) to a backend
>> (custom http server) using SubRequest methods. If it is for some
>> reason down, and there is no response, i'd like it to fail over to a
>> second server. Is there a way to do this in conf settings or do I
>> have to make code modifications to accomplish this?
>>
>> Any help appreciated.
>
> upstream failover {
>    server 1.1.1.1;
>    server 2.2.2.2 backup;
> }
>
> server {
>    [...]
>    location / {
>        proxy_pass http://failover;
>    }
>    [...]
> }
> --
> br, Denis F. Latypoff.
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://nginx.org/mailman/listinfo/nginx
>



More information about the nginx mailing list