serve healthcheck file locally
Tim Dunphy
bluethundr at gmail.com
Sun Jul 20 17:07:35 CEST 2014
>
> You can serve content directly using a synthetic response. Other than
> that, you'll need to run a local webserver and redirect requests for
> that file to the appropriate backend.
Having said that, if you want proper end to end testing, you're better
> off either serving the healthcheck file from the backends with a
> passthrough (so you can ensure that varnish is able to get to at least
> one backend) or with a very short TTL (tests caching as well as backend
> availability, but has a longer recovery time if a varnish host is unable
> to reach any backends).
Thanks for your input! So the idea here is to get the varnish servers
themselves check in with the F5. It's a form of health check polling that
they do to determine that the varnish hosts are online. I could do a pass
through to the web servers to serve the health check file. That should
still let the F5's know that the varnish hosts are alive.
But for now I've just fired up a copy of apache locally on port 80. So as
of now I can do a GET on that healthcheck file:
[root at varn001 varnish]# GET http://$(hostname -f)/healthcheck.php
good
And I tried popping the following into my sub recv_vcl in the hopes that it
could return the same result on 8080:
# Let all health check requests from F5 pass through completely.
if (req.url ~ "^/healthcheck\.php") {
return (pipe);
}
But after I bounce varnish with the change I get this result:
[root at varn001 varnish]# GET http://$(hostname -f):8080/healthcheck.php
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /healthcheck.php was not found on this server.</p>
<hr>
<address>Apache Server at varn001.dmz.tfayd.com Port 8080</address>
</body></html>
Any thoughts on how to solve this?
Thanks,
Tim
On Sun, Jul 20, 2014 at 10:35 AM, Paul Armstrong <varnish-cache at otoh.org>
wrote:
> At 2014-07-20T10:36-0400, Tim Dunphy wrote:
> > Such that you can do a :
> > GET http://$(hostname -f):8080/healtcheck.php
> > And return the contents of that file (which is simply the word
> 'good').
> > I've been googling a while and not found any advice on how to server a
> > text file locally on the varnish server itself.
> > Is there any way I can do this easily in my VCL?
>
> You can serve content directly using a synthetic response. Other than
> that, you'll need to run a local webserver and redirect requests for
> that file to the appropriate backend.
>
> Having said that, if you want proper end to end testing, you're better
> off either serving the healthcheck file from the backends with a
> passthrough (so you can ensure that varnish is able to get to at least
> one backend) or with a very short TTL (tests caching as well as backend
> availability, but has a longer recovery time if a varnish host is unable
> to reach any backends).
>
> Paul
>
> _______________________________________________
> varnish-misc mailing list
> varnish-misc at varnish-cache.org
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>
--
GPG me!!
gpg --keyserver pool.sks-keyservers.net --recv-keys F186197B
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20140720/8e312275/attachment.html>
More information about the varnish-misc
mailing list