木榛

导航

缓存为王-varnish

 

2、varnish的软件清单

 

[root@centos69 ~]# rpm -ql varnish  
/etc/logrotate.d/varnish
/etc/rc.d/init.d/varnish
/etc/rc.d/init.d/varnishlog
/etc/rc.d/init.d/varnishncsa
/etc/sysconfig/varnish
/etc/varnish
/etc/varnish/default.vcl
/usr/bin/varnishadm
/usr/bin/varnishhist
/usr/bin/varnishlog
/usr/bin/varnishncsa
/usr/bin/varnishreplay
/usr/bin/varnishsizes
/usr/bin/varnishstat
/usr/bin/varnishtest
/usr/bin/varnishtop
/usr/sbin/varnish_reload_vcl
/usr/sbin/varnishd
/usr/share/doc/varnish-2.1.5
/usr/share/doc/varnish-2.1.5/ChangeLog
/usr/share/doc/varnish-2.1.5/INSTALL
/usr/share/doc/varnish-2.1.5/LICENSE
/usr/share/doc/varnish-2.1.5/README
/usr/share/doc/varnish-2.1.5/README.redhat
/usr/share/doc/varnish-2.1.5/examples
/usr/share/doc/varnish-2.1.5/examples/default.vcl
/usr/share/doc/varnish-2.1.5/examples/zope-plone.vcl
/usr/share/man/man1/varnishadm.1.gz
/usr/share/man/man1/varnishd.1.gz
/usr/share/man/man1/varnishhist.1.gz
/usr/share/man/man1/varnishlog.1.gz
/usr/share/man/man1/varnishncsa.1.gz
/usr/share/man/man1/varnishreplay.1.gz
/usr/share/man/man1/varnishsizes.1.gz
/usr/share/man/man1/varnishstat.1.gz
/usr/share/man/man1/varnishtest.1.gz
/usr/share/man/man1/varnishtop.1.gz
/usr/share/man/man7/vcl.7.gz
/var/lib/varnish
/var/log/varnish

 

 

三台机器,两个后端web server
 
1、准备两台web server
 
 

2、创建10个测试页
 
for i in {1..10}; do echo "Page $i on Web1" > /var/www/html/test$i.html; done

 

修改

vim  default.vcl

# Default backend definition. Set this to point to your content server.
backend default {
    .host = "192.168.142.134";            #指定后端web server地址
    .port = "80";
}

sub vcl_recv {
    # Happens before we check if we have this in cache already.
    #
    # Typically you clean up the request here, removing cookies you don't need,
    # rewriting the request, etc.
}

sub vcl_backend_response {
    # Happens after we have read the response headers from the backend.
    #
    # Here you clean the response headers, removing silly Set-Cookie headers
    # and other mistakes your backend does.
}

sub vcl_deliver {
    # Happens when we have all the pieces we need, and are about to send the
    # response to the client.
    #
    # You can do accounting or modifying the final object here.
}
                                                     

 是 

 

 

[root@CentOS71 varnish]#varnishadm -S /etc/varnish/secret -T 127.0.0.1:6082
200        
-----------------------------
Varnish Cache CLI 1.0
-----------------------------
Linux,3.10.0-693.el7.x86_64,x86_64,-smalloc,-smalloc,-hcritbit
varnish-4.0.5 revision 07eff4c29

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

help
200        
help [<command>]
ping [<timestamp>]
auth <response>
quit
banner
status
start
stop
vcl.load <configname> <filename>
vcl.inline <configname> <quoted_VCLstring>
vcl.use <configname>
vcl.discard <configname>
vcl.list
param.show [-l] [<param>]
param.set <param> <value>
panic.show
panic.clear
storage.list
vcl.show [-v] <configname>
backend.list [<backend_expression>]
backend.set_health <backend_expression> <state>
ban <field> <operator> <arg> [&& <field> <oper> <arg>]...
ban.list

 

posted on 2018-07-14 15:25  木榛  阅读(131)  评论(0)    收藏  举报