[Varnish] #407: Documentation : the restart sample does not work if the backend is dead
Varnish
varnish-bugs at projects.linpro.no
Tue Dec 16 18:02:53 CET 2008
#407: Documentation : the restart sample does not work if the backend is dead
---------------------+------------------------------------------------------
Reporter: jfbubus | Type: documentation
Status: new | Priority: normal
Milestone: | Component: documentation
Version: trunk | Severity: normal
Keywords: |
---------------------+------------------------------------------------------
The VCLExampleRestarts sample does not work if the backend is away.
It works better using probes & health checking :
{{{
backend b1 {
.host = "fs.freebsd.dk";
.port = "82";
.probe = {
.url = "/probe.cgi";
.timeout = 34 ms;
.interval = 1s;
.window = 10;
.threshold = 8;
}
}
backend b2 {
.host = "fs.freebsd.dk";
.port = "81";
.probe = {
.url = "/probe.cgi";
.timeout = 34 ms;
.interval = 1s;
.window = 10;
.threshold = 8;
}
}
backend b3 {
.host = "fs.freebsd.dk";
.port = "80";
.probe = {
.url = "/probe.cgi";
.timeout = 34 ms;
.interval = 1s;
.window = 10;
.threshold = 8;
}
}
sub vcl_recv {
set req.backend = b1;
if (req.restarts == 1 || !req.backend.healthy) {
set req.backend = b2;
}
if (req.restarts == 2 || !req.backend.healthy) {
set req.backend = b3;
}
}
sub vcl_fetch {
## If the request to the backend returns a code other than 200,
restart the loop
## If the number of restarts reaches the value of the parameter
max_restarts,
## the request will be error'ed. max_restarts defaults to 4.
This prevents
## an eternal loop in the event that, e.g., the object does not
exist at all.
if (obj.status != 200 && obj.status != 403 && obj.status != 404) {
restart;
}
}
}}}
--
Ticket URL: <http://varnish.projects.linpro.no/ticket/407>
Varnish <http://varnish.projects.linpro.no/>
The Varnish HTTP Accelerator
More information about the varnish-bugs
mailing list