Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 13 Dec 2012 13:19:59 +0100
From:      Joar Jegleim <joar.jegleim@gmail.com>
To:        questions@freebsd.org
Subject:   regarding carp and nginx
Message-ID:  <CAFfb-hoHHdbKM1rpxTDMM69d5yBDKyB7eyY-aooTJr7-GXx6wA@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
Hi !

I'm in the process of setting up a HA nginx proxy using carp in
FreeBSD 9.0-RELEASE .
I've got a active/passive setup where both nodes are running an nginx
server listening to carp0 .

If I issue: ifconfig carp0 down on the active node, the passive node
takes over immediately .
But when I for instance issue a simple reboot from the master node,
then try accessing any web page through the proxy I'm getting a
connection error for 3-5 seconds .
It's kinda strange because if I ping the carp0 ip from my workstation
when reboot'ing the master I don't see this kind of drop in connection
(that is the passive node immediatly becomes master and reply my ping)

I've tried having nginx listen to all available interfaces, same result.
I've tried writing a simple devd.conf rule such as:
notify 0 {
   match "system"      "IFNET";
   match "type"        "LINK_UP";
   match "subsystem"       "carp*";
   action "/root/bin/carpcontrol.sh $type $subsystem";
};

notify 0 {
   match "system"      "IFNET";
   match "type"        "LINK_DOWN";
   match "subsystem"       "carp*";
   action "/root/bin/carpcontrol.sh $type $subsystem";
};

where carpcontrol.sh got:
#!/bin/sh

type=$1
subsystem=$2

echo "$(date) called with type=$type and subsystem=$subsystem" >>
/var/log/carp/carp.log
/usr/local/etc/rc.d/nginx restart >> /var/log/kit/carp.log
2>>/var/log/carp/carp.log


which doesn't help, I still get 3-5 seconds drop in connection if I
reboot the master node .
I've also tried to just cut the power for the master node, still
getting those 3-5 seconds drop .

I've set the following in sysctl.conf
#Accept incoming CARP packets. Enabled by default.
net.inet.carp.allow=1
#This option downs all of the CARP interfaces on the host when one of
them goes down. Disabled by default
net.inet.carp.preempt=1
#A value of 0 disables any logging. A Value of 1 enables logging of
bad CARP packets. Values greater than 1 enables logging of state
changes for the CARP interfaces. The default value is 1.
net.inet.carp.log=2



-- 
----------------------
Joar Jegleim
Homepage: http://cosmicb.no
Linkedin: http://no.linkedin.com/in/joarjegleim
fb: http://www.facebook.com/joar.jegleim
AKA: CosmicB @Freenode

----------------------



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAFfb-hoHHdbKM1rpxTDMM69d5yBDKyB7eyY-aooTJr7-GXx6wA>