知乎专栏 |
$ varnishstat or $ varnishstat -n /var/lib/varnish/atom-netkiller/
HTTP Head
$ curl -I http://bg7nyt.mooo.com/ HTTP/1.1 404 Not Found X-Powered-By: PHP/5.2.6-3ubuntu4.2 Content-type: text/html Server: lighttpd/1.4.19 Content-Length: 539 Date: Wed, 23 Sep 2009 00:05:11 GMT X-Varnish: 938430316 Age: 0 Via: 1.1 varnish Connection: keep-alive
test gzip,defalte
$ curl -H Accept-Encoding:gzip,defalte -I http://bg7nyt.mooo.com/ HTTP/1.1 200 OK X-Powered-By: PHP/5.2.6-3ubuntu4.2 Content-Encoding: gzip Vary: Accept-Encoding Content-type: text/html Server: lighttpd/1.4.19 Date: Wed, 23 Sep 2009 00:08:51 GMT X-Varnish: 938430335 Age: 0 Via: 1.1 varnish Connection: keep-alive
help messages
$ varnishadm -T 127.0.0.1:6082 help help [command] ping [timestamp] status start stop stats vcl.load <configname> <filename> vcl.inline <configname> <quoted_VCLstring> vcl.use <configname> vcl.discard <configname> vcl.list vcl.show <configname> param.show [-l] [<param>] param.set <param> <value> quit purge.url <regexp> purge.hash <regexp> purge <field> <operator> <arg> [&& <field> <oper> <arg>]... purge.list
通过Varnish管理端口,使用正则表达式批量清除缓存:
清除所有缓存
/usr/local/varnish/bin/varnishadm -T 127.0.0.1:6082 url.purge *$
http://bg7nyt.mooo.com/zh-cn/technology/news.html 清除类/zh-cn/下所有缓存
/usr/local/varnish/bin/varnishadm -T 127.0.0.1:6082 url.purge /zh-cn/
/usr/local/varnish/bin/varnishadm -T 127.0.0.1:3500 url.purge w*$
varnishtop -i rxurl varnishtop -i txurl varnishtop -i RxHeader -I Accept-Encoding