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

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

Centos
# 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.1:2000
Varnish有一个基于文本的管理接口,启动它的话可以在不停止varnish的情况下来管理varnish。您可以指定管理软件监听哪个接口。当然您不能让全世界的人都能访问您的varnish管理接口,因为他们可以很轻松的通过访问varnish管理接口来获得您的root访问权限。我推荐只让它监听本机端口。如果您的系统里有您不完全信任的用户,您可以通过防火墙规则来限制他访问varnish的管理端口。
-a 0.0.0.0:
制定varnish监听所有IP发给8080端口的http请求,如果在生产环境下,您应该让varnish监听80,这也是默认的。
vcl配置文件的介绍请执行如何命令查看:
man /usr/local/varnish/share/man/man7/vcl.

最新文章

  1. codeforces754D Fedor and coupons
  2. mysql datatime 设置默认值为CURRENT_TIMESTAMP报错`Invalid default value`
  3. 两台装有Ubuntu系统的服务器搭建VPN(一台为本地服务器,另一台为云服务器)
  4. ALV 输入数据时数字缩小一千倍的问题解决
  5. wp8 入门到精通 测量代码执行时间
  6. JS之对象
  7. Tempdb的并发阻塞
  8. HDU 4031 Attack(线段树/树状数组区间更新单点查询+暴力)
  9. h3c 交换机配置VLAN和远程管理
  10. pcap的pcap_dump()保存的文件格式
  11. 实现一个基于tcc/tlink的简单的编译链接工具
  12. Raid1源代码分析--读流程(重新整理)
  13. openwrt教程 第一章 物联网&openwrt开发概述
  14. linux内核包转发过程(三)NIC帧接收分析
  15. Nginx动态路由的新姿势:使用Go取代lua
  16. Transactional ejb 事务陷阱
  17. T-SQL DISTINCT子句 去重复
  18. BeatifulSoup模块
  19. Python开发——5.函数
  20. Programming internal SRAM over SWD

热门文章

  1. xhtml和html的差別
  2. C# 8小特性
  3. 非关心数据库无法进行连表查询 所以我们需要在进行一对多查询时候 无法满足 因此需要在"1"的一方添加"多"的一方的的id 以便用于进行连表查询 ; 核心思想通过id进行维护与建文件
  4. 自学Linux Shell18.1-sed编辑器基础特性
  5. CF1101D GCD Counting(数学,树的直径)
  6. HDU 3338 Kakuro Extension (网络流,最大流)
  7. re正则模块(二十五)
  8. word产品密钥激活
  9. 用矩阵和待定系数法求数列的分析(复杂度log(n))
  10. hdu 1114Piggy-Bank(完全背包)