Maintenance message

Brad Schick schickb at gmail.com
Wed Feb 10 07:54:56 CET 2010


I have a varnish server working well, but I'd like to have a standby server that does nothing but server up "Sorry we are preforming maintenance". My thought was to write VCL code to check the health of the director, and if that was bad use a different server (something like the example below). But that doesn't work. Any suggestions?

backend web1 {
    .host = "10.0.0.1";
    .probe = {
        .url = "/";
        .window = 5;
        .threshold = 3;
    }
}

backend web2 {
    .host = "10.0.0.2";
    .probe = {
        .url = "/";
        .window = 5;
        .threshold = 3;
    }
}

backend maint {
    .host = "127.0.0.1";
}
                          
director cluster round-robin {
    { .backend = web1; }
    { .backend = web2; }
}

sub vcl_recv {
    if(cluster.healthy){
        set req.backend = cluster;
    } 
    else {
        set req.backend = maint;
    }
    ...
}

sub vcl_fetch {
    if(req.backend == maint) {
        pass; 
    }
   ...
}


More information about the varnish-misc mailing list