Varnishadm: how to load a new VCL without restarting

Connect via Varnishadm to Varnish instance:


$ varnishadm -T varnish_server_ip:varnish_server_admin_port -S /opt/varnish/etc/secret
200
-----------------------------
Varnish Cache CLI 1.0
-----------------------------
Linux,3.18.7+,armv6l,-smalloc,-smalloc,-hcritbit
varnish-4.0.3 revision b8c4a34

Type 'help' for command list.
Type 'quit' to close CLI session.
varnish>

Display currently load VCL by using vcl.list command:


varnish>vcl.list
200
active          0 boot
varnish>

Load & compile new VCL by using vcl.load command:


varnish> vcl.load new_vcl "/opt/varnish/etc/config/new_vcl.vcl"
200
VCL compiled.
varnish>

Use the new VCL by using vcl.use command:


varnish> vcl.use new_vcl
200
VCL 'new_vcl' now active
varnish>

Check loaded & active VCL by using vcl.list command:


varnish> vcl.list
200
available       0 boot
active          0 new_vcl
varnish> 

Remove the old VCL by using vcl.discard command:


varnish> vcl.discard boot
200
varnish>

Leave a Reply