Loadbalancing with 301 / 302

Enno van Amerongen enno at tty.nl
Thu Jul 28 14:26:54 CEST 2011


Hi,

First of all, if you get an error, tell us what it is.

Second, you seem to have copypasted the healthchecks directly from the
docs, not sure if it works or if its a typo in the docs, but I'd say:
.timeout = 1s (without the space)

Third, your vcl_recv is wrong, try:

sub vcl_recv {
    set req.backend = baz;
    return (lookup);
}

good luck!

Carsten Dietz wrote:
>
> Hi,
>
>  
>
> I want to setup varnish as an loadbalancer for 4-5 Downloadserver.
>
> The best way to loadbalance with Failover is Roundrobin.
>
>  
>
>  
>
> backend img4 {
>
>   .host = "img4.test.com";
>
>   .probe = {
>
>                 .url = "/";
>
>                 .interval = 5s;
>
>                 .timeout = 1 s;
>
>                 .window = 5;
>
>                 .threshold = 3;
>
>   }
>
> }
>
>  
>
> backend img5 {
>
>   .host = "img5.test.com ";
>
>   .probe = {
>
>                 .url = "/";
>
>                 .interval = 5s;
>
>                 .timeout = 1 s;
>
>                 .window = 5;
>
>                 .threshold = 3;
>
>   }
>
> }
>
>  
>
>  
>
> backend img6 {
>
>   .host = "img6.test.com ";
>
>   .probe = {
>
>                 .url = "/";
>
>                 .interval = 5s;
>
>                 .timeout = 1 s;
>
>                 .window = 5;
>
>                 .threshold = 3;
>
>   }
>
> }
>
>  
>
> backend img7 {
>
>   .host = "img7.test.com ";
>
>   .probe = {
>
>                 .url = "/";
>
>                 .interval = 5s;
>
>                 .timeout = 1 s;
>
>                 .window = 5;
>
>                 .threshold = 3;
>
>   }
>
> }
>
>  
>
> director baz round-robin {
>
>         {
>
>                 .backend = img4;
>
>         }
>
>         {
>
>                 .backend = img5;
>
>         }
>
>          {
>
>                 .backend = img6;
>
>         }
>
>          {
>
>                 .backend = img7;
>
>         }
>
>        
>
> }
>
>  
>
> sub vcl_recv {
>
>   set obj.http.Location = baz;
>
>   set obj.status = 301;
>
>   return(deliver);
>
> }
>
>  
>
> I try to set other variables but it try to start with this gives an error.
>
>  
>
>
> Has anybody an idea how it can works?
>
>  
>
> Thanks Carsten
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> varnish-misc mailing list
> varnish-misc at varnish-cache.org
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc






More information about the varnish-misc mailing list