camscape - for excellent IT solutions itkb.ro - IT knowledge base

linux :: reload varnish

David
David G.
TitleReload Varnish
Tagsvarnish,reload,without restart
Desc.Reload varnish configuration without restart
CodeKBLN0043 v1.0
Date20 mai 2020

Restarting Varnish will cause losing of existing cache with, sometimes, huge impact on working site.

 

If you did some change in Varnish configuration, all you need is to reread the configuration, without restart.

 

Asume you run Varnish on 127.0.0.1 on port 6082 (administrative port, not request port). Asume VCL config is in /etc/varnish/default.vcl

 

List existing configurations:

 

varnishadm -T 127.0.0.1:6082 vcl.list

 

will output:

 

available       0 boot
available     586 varnish_20200506
available       0 varnish_20200513
available       0 varnish_20200513-2
active        163 varnish_20200514

 

Now, reload configuration into a new entry:

 

varnishadm -T 127.0.0.1:6082 vcl.load varnish_newconfig20 /etc/varnish/default.vcl

 

and activate it:

 

varnishadm -T 127.0.0.1:6082 vcl.use varnish_newconfig20