Thursday, October 23, 2014

Debugging varnish's configuration

Sometimes, I try to modify varnish's configuration /etc/varnish/default.vcl, something like adding new backends, turning on/off caching for a specific backend... Then I have to reload varnish:

# service varnish reload

but it fail!

Reloading HTTP accelerator: varnishdCommand failed with error code 106

without saying anything else, I meant which part of the configuration caused that error?

Fortunately, there is a command to debug varnish's configuration:

# /usr/sbin/varnishd -Cf /etc/varnish/default.vcl
Message from VCC-compiler:
Expected one of
        'acl', 'sub', 'backend', 'director', 'probe',  or 'import'
Found: 'v' at
('input' Line 473 Pos 1)
v#     </address>

It shows me exactly where I should go back and fix. Quite convenient!