Last active
May 6, 2020 22:30
-
-
Save mttjohnson/da3b048282d49e6ff356 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 stats | |
varnishstat -n prod | |
# 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"' | |
# Use a query to watch requests to a specific path | |
varnishlog -n prod -q 'ReqURL eq "/product_page.html" or BereqURL eq "/product_page.html"' | |
# Watch for a MISS | |
varnishlog -n prod -q 'VCL_call eq "MISS"' | |
# 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