PREREQUISITES

apache2, mod_perl or at least perl. extra perlmodules see mandatory 3rd-party perlmodules

MAINTAINANCE

databasecleanup

the backend leaves lock-files for users and entries that needs to be deleted

rebuild search and reaload server

OBSOLETE since introduction of the goldfisch::searchd-module and fixing several memleak-bugs.

the searchindex is rebuilt every night. If using mod_perl the apache-server must be restarted every night to get aware of the new index. To do this, we clone the apache-config and just replace the listening IP, the pid-file and the IP’s for the virtual hosts. We start this new server and have it listing on an alternate IP. Then we install a traffic-forward from old ip to new ip, stop the old server, start it again, remove the traffic-forward and stop the other server.

#!/bin/bash

pid=`cat /usr/local/apache2/logs/pid-139.pid`
if [ x$pid != x ]; then
  echo create backupconfig
  echo "#">/usr/local/apache2/conf/httpd-141.conf
  echo "# AUTOGENERATED CONFIG DO NOT MODIFY" >>/usr/local/apache2/conf/httpd-141.conf
  echo "#">>/usr/local/apache2/conf/httpd-141.conf
  cat /usr/local/apache2/conf/httpd-139.conf | perl -e 'while (<STDIN>) {s/62.99.149.139/62.99.149.141/g;s/pid-139/pid-141/
g;print}'>>/usr/local/apache2/conf/httpd-141.conf
  echo start up backupserver
  /usr/local/apache2/bin/httpd -DSSL -c "Include conf/httpd-141.conf" -k "start"
  echo  redirect traffic to backupserver
  iptables -A PREROUTING -t nat -p TCP -d 62.99.149.139 --dport 80 -j DNAT --to 62.99.149.141:80
  iptables -A OUTPUT -t nat -p TCP -d 62.99.149.139 --dport 80 -j DNAT --to 62.99.149.141:80
  echo  stop mainserver
  /usr/local/apache2/bin/httpd -DSSL -c "Include conf/httpd-139.conf" -k "stop"
  echo  wait for sure shutdown
  while (ps -p $pid | grep httpd) >/dev/null; do sleep 1; done
  echo  restart mainserver
  /usr/local/apache2/bin/httpd -DSSL -c "Include conf/httpd-139.conf" -k "start"
  echo wait for mainserver active
  while ( [ ! -e /usr/local/apache2/logs/pid-139.pid ] ); do sleep 1; done
  echo  delete redirect-rules
  iptables -D OUTPUT 1 -t nat
  iptables -D PREROUTING 1 -t nat
  echo  stop backupserver
  /usr/local/apache2/bin/httpd -DSSL -c "Include conf/httpd-141.conf" -k "stop"
fi
 
kb/server/maintainance.txt · Last modified: 2007/03/08 09:14