Here is the set up I am trying to accomplish
So, what I'm trying to accomplish is: a user goes to 10.0.0.1 it passes it to whichever loadbalancer is managing the requests. I then want varnish actually to handle the request.
Here is my ha.cf file:
debug 3
debugfile /var/log/ha-debug
logfile /var/log/ha-log
bcast eth0
keepalive 2
warntime 5
deadtime 15
initdead 30
udpport 694
udp eth0
auto_failback yes
node loadb1
node loadb2
*This is the same on loadb2. Also I have the debugging enable for testing purposes. It will be removed when its production ready.
Here is haresources
loadb1 IPaddr::10.0.11.200/32 varnishd
*Again, same on loadb2 (I have also tried to make it so that heartbeat doesn't manage anything other than the IP; so no "varnishd" at the end in the haresources)
My varnish config is as follows:
backend server1 {
.host = "10.5.0.111";
.probe = {
.url = "/";
.interval = 5s;
.timeout = 1 s;
.window = 5;
.threshold = 3;
}
}
backend server2 {
.host = "10.5.0.112";
.probe = {
.url = "/";
.interval = 5s;
.timeout = 1 s;
.window = 5;
.threshold = 3;
}
}
director example_director random {
{
.backend = server1;
.weight = 2;
}
{
.backend = server2;
.weight = 1;
}
}
sub vcl_recv {
if (req.http.host ~ "^(www.)?bps101.net$") {
set req.backend = example_director;
}
}
I have my heartbeat working fine. The ip 10.0.0.1 is fully pingable. But when I got to 10.0.0.1 in a browser I get a connection reset. (nothing is listening on port 80). I know the varnish config works. I know the heartbeat config works. I just cannot get them to work together. Does anyone have any suggestions or ideas? I would greatly appreciate any advice, direction, etc that anyone can provide. Thanks.
You can make your own script under resources.d so that heartbeat can manage the varnish deamon.
A simple solution would be
You can find a small manual in german language under http://foobar.lamp-solutions.de/howtos/lamp-administration/tuning/tuning-einzelansicht/archive/2011/may/article/hoechverfuegbarer-http-loadbalancer-mit-varnish-und-heartbeat-unter-ubuntu-1004.html
Ok, the basics:
ip ad show
)netstat -tanp
)If those two are correct, some weirder is happening :) I use a similar solution to yours that I described on this answer, you can use the same stuff and only use 1 ip to achieve the same effect you want.
Yes, it is. The problem appeared to be that my heartbeat haresources config needed to not have the "varnishd" in it. For whatever reason, heartbeat hated that. So heartbeat isn't fully managing varnish. But I have cronjob that is running a script to see if varnish is running. If it's not, restart it.