Varnish VCL Reload Fails After Adding Second Backend

7,265

I've not seen that specific error, but, when putting a backend in, I have noticed if the backend isn't referenced within the config, it has given me problems when restarting on our development servers.

storage_file: filename: /var/lib/varnish/devel/varnish_storage.bin size 1024 MB.
Message from VCC-compiler:
Unused backend default2, defined:
(input Line 11 Pos 9)
backend default2 {
--------########--
Running VCC-compiler failed, exit 1
VCL compilation failed

So, is it possible that you have no rule referencing the backend?

Share:
7,265

Related videos on Youtube

Andy
Author by

Andy

Updated on September 17, 2022

Comments

  • Andy
    Andy almost 2 years

    I have been running Varnish on my production server successfully for several weeks now. Now I'm trying to configure Varnish to use a second backend for certain requests. My original working VCL (/etc/varnish/default.vcl) begins like this:

    backend default {
      .host = "127.0.0.1";
      .port = "8080";
    }
    
    ...rest of VCL...
    

    And I'm changing it to:

    backend default {
      .host = "127.0.0.1";
      .port = "8080";
    }
    
    backend backend2 {
      .host = "12.34.56.78";
      .port = "80";
    }
    
    ...rest of VCL...

    When I reload the VCL file, I get the following:

    Command failed with error code 106
    Failed to reload /etc/varnish/default.vcl.
    

    Any idea what the error could be, or how I can get more information on the problem?

    (Note: To reload the VCL, I'm using the script found here: http://kristian.blog.linpro.no/2009/02/18/easy-reloading-of-varnish-vcl/)

  • Andy
    Andy over 14 years
    Thank you for the suggestion. I've tried it both ways -- with and without the relevant rule referencing the backend but to no avail. Also, how do you view the VCC-compiler output? If I could see that, it might give me the clue I need.
  • Andy
    Andy over 14 years
    Interestingly, it turns out that my problem was related to your suggestion. When I reloaded the VCL without referencing the backend in the config, I got the error. When I reloaded the VCL with a reference to the backend, I still got the error -- but that was because I had a syntax error in the line referencing the backend (I put "req.backend = backend2;" instead of "set req.backend = backend2;". When I corrected the syntax error, the VCL reloaded normally and now works as expected. Thanks!
  • Admin
    Admin over 14 years
    telnet to the admin interface: telnet localhost 6082 vcl.load -C /etc/varnish/default.vcl or, if you restart the daemon through most init scripts, they shouldn't hide STDERR.