• Varish 缓存


    varish 缓存 2013年06月17日,Varnish Cache 3.0.4 发布,为目前最新版本。

    varish是以内存作为共享容器的;内存的大小决定了它的缓存容量。相对于主要以硬盘为存储的squid来说要高效的多。它适合一些经常查询且变化不大的静态内容缓存。

    Centos 6
    # wget https://repo.varnish-cache.org/source/varnish-4.1.5.tar.gz
    
    安装依赖;
    yum install -y autoconf automake jemalloc-devel libedit-devel libtool ncurses-devel pcre-devel pkgconfig python-docutils python-sphinx
    
    官网依赖提示:
    yum install autoconf automake jemalloc-devel libedit-devel libtool ncurses-devel pcre-devel pkgconfig python-docutils python-sphinx graphviz -y 
    
    编译检测:
    ./configure 
     --prefix=/usr/local/varnish/ 
     --enable-dependency-tracking 
     --enable-developer-warnings 
     --enable-debugging-symbols
     

    官方提供方式:

    yum 安装: 
    yum install epel-release
    rpm --nosignature -i https://repo.varnish-cache.org/redhat/varnish-4.1.el6.rpm
    yum install varnish

    源码安装:
    配置检依赖 sh autogen.sh sh configure 或者 .
    /configure --prefix=/usr/local/varnish make make check make install

    测试:

    启动 /usr/local/varnish/sbin/varnishd -u www -g www -f /usr/local/varnish/etc/varnish/jeeson.vcl -a 0.0.0.0:80 -s file,/data/varnish/cache/varnish_cache.data,10G -w 1024,51200,10 -t 3600 -T localhost:3000

    启动varnish:
    varnishd -f /usr/local/varnish/etc/varnish/default.vcl -s malloc,1G -g varnish -u varnish -T 127.0.0.1:2000
    关闭varnish: pkill varnish
    启动参数介绍:
    -f /usr/local/etc/varnish/default.vcl 这个 –f 选项指定varnishd使用哪个配置文件。 -s malloc,1G –s 选项用来确定varnish使用的存储类型和存储容量,我使用的是malloc类型(malloc是一个C函数,用于分配内存空间), 1G 定义多少内存被malloced,1G = 1gigabyte。 -T 127.0.0.12000
    Varnish有一个基于文本的管理接口,启动它的话可以在不停止varnish的情况下来管理varnish。您可以指定管理软件监听哪个接口。当然您不能让全世界的人都能访问您的varnish管理接口,因为他们可以很轻松的通过访问varnish管理接口来获得您的root访问权限。我推荐只让它监听本机端口。如果您的系统里有您不完全信任的用户,您可以通过防火墙规则来限制他访问varnish的管理端口。 -a 0.0.0.08080 制定varnish监听所有IP发给8080端口的http请求,如果在生产环境下,您应该让varnish监听80,这也是默认的。
    vcl配置文件的介绍请执行如何命令查看: man
    /usr/local/varnish/share/man/man7/vcl.7
  • 相关阅读:
    青岛理工大学邀请赛总结
    HDU 1232 并查集/dfs
    HDU 1556
    HDU 5228
    POJ1011
    线段树(数组实现)
    NOIP2008 普及组T1 ISBN号码 解题报告-S.B.S.
    NOIP2008 普及组T4 立体图 解题报告-S.B.S.(施工未完成)
    noip2008普及组4题题解-rLq
    noip2008普及组3题题解-rLq
  • 原文地址:https://www.cnblogs.com/sharesdk/p/9172162.html
Copyright © 2020-2023  润新知