Re: Carp and Apache
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 ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Re: Carp and Apache
Dave, Yes. 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 -- http://dannyman.toldme.com/ ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"
Carp and Apache
Good afternoon, This might be a stupid question, but that never stopped me before ;^) I've been watching CARP and now that it is in 5.4 I would like to give it a try but I am not able to find much information outside of using it with PF. I am curious how apache should be setup. Where httpd.conf requires an IP for named based hosting, should the httpd.conf contain the IP of the interface or the IP configured with CARP? I believe the carp interface is configured directly on top of the physical interface. That question in mind, am I completely off track here? I currently have ifconfig_em0="inet 10.0.240.140 netmask 255.255.255.0" ifconfig_em1="inet 10.0.241.140 netmask 255.255.255.0" ifconfig_em1_alias0="inet 10.0.241.143 netmask 0x" ifconfig_em1_alias1="inet 10.0.241.144 netmask 0x" ifconfig_em1_alias2="inet 10.0.241.145 netmask 0x" ifconfig_em1_alias3="inet 10.0.241.146 netmask 0x" defaultrouter="10.0.241.1" So from what I have read, simply adding the below should get me setup, providing that this is the rc.conf from the master ifconfig carp0 create ifconfig carp0 vhid 1 pass sdf899734h 10.0.241.140/24 ifconfig carp1 create ifconfig carp1 vhid 1 pass sdf899734h 10.0.241.143/24 ifconfig carp2 create ifconfig carp2 vhid 1 pass sdf899734h 10.0.241.144/24 ifconfig carp3 create ifconfig carp3 vhid 1 pass sdf899734h 10.0.241.145/24 ifconfig carp4 create ifconfig carp4 vhid 1 pass sdf899734h 10.0.241.146/24 Thanks, DAve ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "[EMAIL PROTECTED]"