Categories
Varnish

Reload Varnish VCL using varnishadm

You can reload Varnish config without losing your cache. To do this, you should use the standard varnishadm CLI utility.

First, log in to your Varnish instance and get to Varnish console:

varnishadm -S /usr/local/var/varnish/secret -T localhost:6082

You can perform there some commands. For example, you can list available compiled Varnish configs using the command:

vcl.list

So you have changed your vcl and wish to reload it. First, you should compile the new version of it:

vcl.load varnish_01 /usr/local/etc/varnish/default.vcl

Where varnish_01 is the custom name for your new configuration, you can create multiple configs, but only one is active.

Then after successful compiling, you can apply the new config using:

vcl.use varnish_01

So, the new version of the config is applied. Easy peasy.

To quit the CLI just use:

quit

Leave a Reply

Your email address will not be published. Required fields are marked *