-
-
Save erikhansen/413b7876f2951ea16365dce0f1bffaf5 to your computer and use it in GitHub Desktop.
Varnish Dev Ops
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# clear the entire cache | |
varnishadm "ban req.url ~ /" | |
# monitor varnish log with multiple patterns | |
varnishlog | grep 'eqURL\|Age:\|VCL_call\|TTL\|Expires:\|Cache-Control:' | |
# Use a query with varnishlog to watch requests from a specific IP | |
varnishlog -q 'ReqHeader:X-User-IP eq "1.2.3.4" or BereqHeader:X-User-IP eq "1.2.3.4"' | |
# Monitor PURGE requests hitting Varnish | |
varnishlog -n prod -q 'ReqMethod eq "PURGE"' | |
varnishlog -n prod -q 'ReqMethod eq "PURGE"' | grep 'X-Magento-Tags-Pattern\|X-Pool' | |
# determine the instance names of multiple varnish instances | |
ls -la /var/lib/varnish/ | |
# use varnish log against a specific instance name | |
varnishlog -n stage | |
# purge request using curl from the local machine | |
curl -s -H 'X-Pool: prod' -X PURGE http://127.0.0.1:6081/ | |
# Check config. If a syntax error exists it will produce an error, otherwise it will output the configuration | |
varnishd -C -f /etc/varnish/default.vcl |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment