Varnish
De Hegyd Doc.
Version du 20 juin 2012 à 07:16 par G.lalleman (discuter | contributions)
Sommaire |
Memento
Configuration et commandes du daemon
Elle se fait dans le fichier "/etc/default/varnish", nous pourront utiliser les paramètres suivants :
-a <[hostname]:port> # listen address -f <filename> # VCL file -p <parameter=value> # set tunable parameters -S <secretfile> # authentication secret for management -T <hostname:port> # Management interface -s <storagetype,options> # where and how to store objects (file for file backend and malloc for memory bakend)
Le language VCL
Subroutines
Ci-dessous les différentes section configurable du cache en utilisant le lagnuage VCL.
- backends & directors : Backend servers configuration. It may be multiple backend & director sections.
- vcl_recv : Called at the beginning of a request, after the complete request has been received and parsed. Its purpose is to decide whether or not to serve the request, how to do it, and, if applicanle, which backend to use.
- vcl_hit : Called after a cache lookup if the requested document was found in the cache.
- vcl_miss : Called after a cache lookup if the requested document was not found in the cache. Its purpose is to decide whether or not to attempt to retrieve the document from the backend, and which backend to use.
- vcl_fetch : Called after a document has been retrieved from the backend, before it is inserted into the cache.
- vcl_timeout : Called by the reaper thread when a cached document has reached its expiry time.
= Backends
- Configuration d'un hôte avec test :
backend hostname1 {
.host = "XXX.XXX.XXX.XXX";
.port = "80";
.probe = {
.request =
"GET / HTTP/1.1"
"Host: localhost"
"Connection: close";
}
}
- Round robin
Il faut utiliser une directive director :
director WebSiteA round-robin {
{ .backend = hostname1; }
{ .backend = hostname2; }
}
