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?
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;
}
On Wed, Jul 28, 2010 at 05:36:11PM -0700, James Lyons wrote:
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?
Subrequests in nginx aren’t really different from ordinary
requests, they are handled in the same way - with location
matching and so on. Setting failover correctly in config (either
with proxy_next_upstream or via error_page) would do the trick for
both normal requests and subrequests.
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?
Thanks so much for help so far – with what nginx version is “backup”
introduced?
I have:
378 upstream iks {
379 server 127.0.0.1:5397;
380 server www.testfailover.net:5397 backup;
381 }
on startup I see:
2010/09/14 18:46:46 [emerg] 17835#0: invalid parameter “backup” in
/box/etc/nginx/nginx.conf.iksdev:380
I know we are using 0.6.39 – which is old, so i suspect this is the
problem – but my job has been reluctant to upgrade so far. Is there
a workaround?