CyberKeeda In Social Media
Showing posts with label Varnish-Cache. Show all posts
Showing posts with label Varnish-Cache. Show all posts

Flush or Clear Varnish Cache without restarting Vanish server



I believe Linux Folks and developers create a cheat code to apply each effect without restarting the server.
So on Varnish Server too have a command to flush all cache without restarting at all
varnishadm -T 127.0.0.1:6082 url.purge .
That will flush the cache.
Read more ...

Varnish Cache Server Configuration





Varnish is now installed under the /usr/local directory.
The full path to the main binary is /usr/local/sbin/varnishd.
The default configuration file is /usr/local/etc/varnish/default.vcl.



You can start Varnish by running the varnishd binary. Before you can do that though, you have to tell Varnish which back-end server it's caching for. Let's specify the back end in the default.vcl file. Edit the default.vcl file as shown below, substituting the values for those of your Web server:

Note -:  Important is 1st to Change your Apache's http.conf  Listen port to 8080 

I assume varnishd is in your path. You might want to run pkill varnishd to make sure varnishd isn't running. Become root and type:


[root@cyberkeeda etc]# vim /usr/local/etc/varnish/default.vcl

 backend default {
     .host = "127.0.0.1";
     .port = "8080";
 }

# pkill varnishd

Now you can start Varnish with this command:

[root@cyberkeeda etc]# /usr/local/sbin/varnishd -f /usr/local/etc/varnish/default.vcl -a :6081 -P /var/run/varnish.pid -s malloc,256m

Here Apache is using Varnish Cache using port 6081 -- http:/localhost:6081

The moment you want to move it under production replace it by port 80

# pkill varnishd

[root@cyberkeeda etc]# /usr/local/sbin/varnishd -f /usr/local/etc/varnish/default.vcl -a :80 -P /var/run/varnish.pid -s malloc,256m

Now you can directly open --: http://localhost


If you installed Varnish from your package manager, it may be running already. In that case, you can stop it first, then use the command above to start it manually. Otherwise, the options it was started with may differ from those in this example. A quick way to see if Varnish is running and what options it was given is with the pgrep command:

/usr/bin/pgrep -lf varnish
Varnish now will relay any requests it receives to the back end you specified, possibly cache the response, and deliver the response back to the client. Let's submit some simple GET requests and see what Varnish does. First, run these two commands on separate terminals:

/usr/local/bin/varnishlog
/usr/local/bin/varnishstat

To view communication between Varnish and the client (omitting the back end):

/usr/local/bin/varnishlog -c
To view communication between Varnish and the back end (omitting the client):

/usr/local/bin/varnishlog -b
To view the headers received by Varnish (both the client's request headers and the back end's response headers):

/usr/local/bin/varnishlog -i RxHeader
Same thing, but limited to just the client's request headers:

/usr/local/bin/varnishlog -c -i RxHeader
Same thing, but limited to just the back end's response headers:

/usr/local/bin/varnishlog -b -i RxHeader
To write all log messages to the /var/log/varnish.log file and dæmonize:

/usr/local/bin/varnishlog -Dw /var/log/varnish.log
To read and display all log messages from the /var/log/varnish.log file:

/usr/local/bin/varnishlog -r /var/log/varnish.log

Read more ...

Varnish-Cache Server Installation from Source Code ( tar.gz file )




Varnish is a program that can greatly speed up a Web site while reducing the load on the Web server. According to Varnish's official site, Varnish is a "Web application accelerator also known as a caching HTTP reverse proxy".


One can easily install Varnish-Cache server from yum directly, but this type we are going to install it by source code.

Download Varnish-Cache server   ---  Click here

Download and move it into /var/local directory

[root@cyberkeeda ~]# cd /var/local/

[root@cyberkeeda local]# tar xzf varnish-3.0.3.tar.gz


[root@cyberkeeda local]# cd  varnish-3.0.3

[root@cyberkeeda local]# sh autogen.sh

[root@cyberkeeda local]# configure

[root@cyberkeeda local]# make

[root@cyberkeeda local]#make install

One can find a installed folder by source code /var/local/varnish



Do comment in case of any issue while installation.



Read more ...

Varnish Cache Installation error - No package ‘libpcre’ found



While installation of Varnish Cache Server you might get into trouble and one of the error would be


checking for PCRE... configure: error: Package requirements (libpcre) were not met:

No package 'libpcre' found

Don't worry it's a common package that has been shipped with default Redhat / Centos DVD 

# yum install pcre-devel
Read more ...
Designed By Jackuna