Blog

Posts Tagged varnish

Varnish Cache Commands

How to reload Varnish config while varnish running.

# varnishadm
200
—————————–
Varnish Cache CLI 1.0
—————————–
-sfile,-smalloc,-hcritbit

Type ‘help’ for command list.
Type ‘quit’ to close CLI session.

vcl.load newconfig /etc/varnish/default.vcl
vcl.use newconfig
quit
500
Closing CLI connection

# top IP addresses
varnishtop -i TxHeader -I ‘^X-Forwarded-For:’
# which pages the IP address 103.4.122.20 is hitting
varnishncsa |grep 103.4.122.20 |awk ‘{print $7}’
# IP addresses hitting the /client-perf URL
varnishlog -m ‘RxURL:/client-perf’ |grep ‘X-Forwarded-For’
# IP addresses hitting the /client-perf URL
varnishlog -m ‘RxURL:/client-perf’ |grep ‘X-Forwarded-For’

varnishlog -O -i TxURL -i SessionOpen -i Hash

Posted in: Blog

Leave a Comment (0) →

Varnishlog Error – _.vsm: No such file or directory

# /usr/bin/varnishlog
Cannot open /usr/local/var/varnish/test-varnish/_.vsm: No such file or directory

If you get this error chances are you have both a source and packaged based install.
remove both of them.

1
yum remove varnish

Then go into your source directory

1
make uninstall

Then re-install varnish again from the repo

1
yum install varnish

Posted in: Blog, Technical

Leave a Comment (0) →

Install Varnish 3.0 with VSF (Varnish Security Firewall) on centos 6

Just finished setting up our cluster of varnish servers and its working nicely.
Using lsyncd to replicate the varnish configs, but thats for another post.

Here is a step by step on howto install varnish with VSF (Varnish Security Firewall) on centos 6.
If have already installed varnish then be sure to uninstall it before completing the steps below.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
sed -i 's/SELINUX=.*/SELINUX=permissive/' /etc/sysconfig/selinux
setenforce 0
 
yum groupinstall "Development Tools" -y
yum install docutils pcre-devel gcc* git nano -y
 
cd /tmp
wget http://repo.varnish-cache.org/source/varnish-3.0.3.tar.gz
tar xf varnish-3.0.3.tar.gz && cd varnish-3.0.3 && ./configure
make -j3 && make install
cd -
 
git clone https://github.com/comotion/VSF.git
cd VSF/
 
git clone https://github.com/fastly/libvmod-urlcode.git
git clone https://github.com/nand2/libvmod-throttle.git
git clone https://github.com/xcir/libvmod-parsereq.git
git clone https://github.com/varnish/libvmod-shield.git
 
for mod in parsereq urlcode shield throttle; do
   cd libvmod-$mod
   ./autogen.sh && VARNISHSRC=/tmp/varnish-3.0.3 VMODDIR=/usr/lib64/varnish/vmods ./configure && make -j3
   make install
   cd -
done
 
cd /tmp/varnish-3.0.3 
make uninstall
 
rpm --nosignature -i http://repo.varnish-cache.org/redhat/varnish-3.0/el5/noarch/varnish-release-3.0-1.noarch.rpm
yum install varnish -y
chkconfig varnish on
 
mv /tmp/VSF/ /usr/share/
cd /etc/varnish && ln -s /usr/share/VSF/vcl security
 
nano /etc/varnish/default.vcl

Now add:
include “/etc/varnish/security/vsf.vcl”;
edit /etc/sysconfig/varnish to change the listen port to 80

reboot and you should be good to go!

Posted in: Scripts

Leave a Comment (3) →