Danny Howard wrote:
Dave,
Yes.
"Yes" both apache servers have the same IP in httpd.conf? or "Yes" I am
completely off base in my understanding?
Not certain I can go this route right now anyway as I do not have enough
test boxes to setup a trial. There seems to be a shortage of good docs
on using CARP outside of using it with PF.
Thanks,
DAve
The trick with CARP is that it is an IP-level heartbeat, so if you are
running Apache, you want to "carp up" after you start apache, and "carp
down" before you stop Apache.
From some test boxes, web0:
ifconfig_fxp1="inet 192.168.1.210 netmask 255.255.255.0"
defaultrouter="192.168.1.1"
cloned_interfaces="carp0 carp1"
Then, web0 application config file:
export CARP_PASS="mekmitasdigoat"
# MASTER
export CARP_carp0_IP=192.168.1.206
export CARP_carp0_VHID=1
# SLAVE
export CARP_carp1_IP=192.168.1.207
export CARP_carp1_VHID=2
export CARP_carp1_SKEW=100
Next, the Application "control" script:
# CARP
carp_ifs=`ifconfig -l | tr ' ' '\n' | grep carp`
# Set up CARP
for carp_if in $carp_ifs; do
eval carp_ip=\$CARP_${carp_if}_IP
eval carp_vhid=\$CARP_${carp_if}_VHID
eval carp_skew=\$CARP_${carp_if}_SKEW
if [ -n "$carp_vhid" ]; then
carp_vhid="vhid $carp_vhid"
fi
if [ -n "$carp_skew" ]; then
carp_skew="advskew $carp_skew"
fi
if [ -n "${carp_ip}" -a -n "${carp_vhid}" ]; then
ifconfig $carp_if pass "$CARP_PASS" $carp_vhid $carp_skew
$carp_ip
ifconfig $carp_if down
else
echo "WARNING: $carp_if but missing CARP_${carp_if}_IP or
CARP_${carp_if}_VHID!"
fi
done
[... later ...]
if [ $status -eq 0 ]; then
echo "Apache successfully ${cmd}ed"
echo "Ready to CARP UP!"
if [ -n "${carp_ifs}" ]; then
for carp_if in $carp_ifs; do
eval carp_ip=\$CARP_${carp_if}_IP
eval carp_vhid=\$CARP_${carp_if}_VHID
if [ -n "${carp_ip}" -a -n "${carp_vhid}" ]; then
ifconfig $carp_if up
fi
done
sysctl net.inet.carp.preempt=1
fi
else
echo "Apache failed to $cmd"
exit 2
fi
Okay, so that's really quite a mess, but basically:
* Set cloned_interfaces in rc.conf to create carp<n> at boot.
* One IP alias and VHID per CARP IP.
* Set up the backup server with higher advskew.
* For availability, teach you apachectl script to ifconfig the carp
interfaces, ifconfig down, start apache, ifconfig up, and ifconfig
down before stopping / restarting apache.
Cheers,
-danny
_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"