From owner-freebsd-questions@FreeBSD.ORG Fri Nov 11 14:38:15 2005 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BFF8F16A41F for ; Fri, 11 Nov 2005 14:38:15 +0000 (GMT) (envelope-from dave.list@pixelhammer.com) Received: from ecluster6.tls.net (ecluster6.tls.net [65.196.224.136]) by mx1.FreeBSD.org (Postfix) with SMTP id 520DB43D46 for ; Fri, 11 Nov 2005 14:38:15 +0000 (GMT) (envelope-from dave.list@pixelhammer.com) Received: (qmail 61546 invoked by uid 89); 11 Nov 2005 14:38:14 -0000 Received: from 64-184-10-171.bb.hrtc.net (HELO ?192.168.0.102?) (ldg%tls.net@64.184.10.171) by auth-ecluster6.tls.net with SMTP; 11 Nov 2005 14:38:14 -0000 Message-ID: <4374ACD1.2030303@pixelhammer.com> Date: Fri, 11 Nov 2005 09:38:09 -0500 From: DAve User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: freebsd-questions@freebsd.org References: <435D5303.3030906@pixelhammer.com> <20051104232635.GT18563@ratchet.nebcorp.com> In-Reply-To: <20051104232635.GT18563@ratchet.nebcorp.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: Carp and Apache X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 11 Nov 2005 14:38:15 -0000 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 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 >