Ticket #911 (closed outage: fixed)

Opened 6 years ago

Last modified 5 years ago

db2 update - 2008-10-15 13:30 UTC

Reported by: mmcgrath Owned by: mmcgrath
Priority: major Milestone: Fedora 10
Component: Systems Version: Production
Severity: Normal Keywords:
Cc: Blocked By:
Blocking: Sensitive:

Description

DB2 upgrade. This will migrate the current base RHEL postgresql server to 8.3 in the infrastructure repo. This is the last db we have running this older version of postgres.

Change History

comment:1 Changed 6 years ago by mmcgrath

  • Status changed from new to assigned
#!/bin/bash                                                                                                                                                         
echo -e                                                                                                                                                             


echo "Initial Values"
echo fas2            
echo "select count(*) from people;" | sudo -u postgres psql fas2
echo bodhi                                                      
echo "select count(*) from package;" | sudo -u postgres psql bodhi
echo elections                                                    
echo "select count(*) from elections;" | sudo -u postgres psql elections
echo pkgdb                                                              
echo "select count(*) from package;" | sudo -u postgres psql pkgdb      
echo mirrormanager                                                      
echo "select count(*) from host;" | sudo -u postgres psql mirrormanager 

echo
echo "Disable puppet"
/etc/init.d/iptables stop

echo
echo "kill old postgres"
/etc/init.d/postgresql stop
echo                       
echo "Disable connections via iptables"
iptables -A INPUT -p tcp -m tcp --dport 5432 -j REJECT --reject-with icmp-host-prohibited
echo                                                                                     
echo "Starting postgres again for dumps"                                                 
/etc/init.d/postgresql start                                                             
echo                                                                                     
echo "dumping db"                                                                        
sudo -u postgres /var/lib/pgsql/save-db /tmp/pgtmp/                                      
echo                                                                                     
echo "verify all dumps exist"                                                            
ls /tmp/pgtmp/bodhi.db                                                                   
ls /tmp/pgtmp/elections.db                                                               
ls /tmp/pgtmp/elections_old.db                                                           
ls /tmp/pgtmp/fas2.db                                                                    
ls /tmp/pgtmp/fedora_updates.db                                                          
ls /tmp/pgtmp/fedorausers.db                                                             
ls /tmp/pgtmp/global.sql                                                                 
ls /tmp/pgtmp/mirrormanager.db                                                           
ls /tmp/pgtmp/pkgdb.db                                                                   
ls /tmp/pgtmp/postgres.db                                                                
ls /tmp/pgtmp/restore.sh                                                                 
echo                                                                                     
echo "stop postgresql"                                                                   
/etc/init.d/postgresql stop
echo
echo "remove old postgres rpms"
yum -y remove postgresql\*
echo
echo "install 8.3 postgres"
yum -y install postgresql8.3-plpython postgresql8.3-contrib postgresql8.3-server postgresql8.3 postgresql8.3-libs
echo
echo "doing the data dir cleanup"
rm -rf /var/lib/pgsql/data-upgrade/
mkdir /var/lib/pgsql/data-upgrade/
mv /var/lib/pgsql/data/* /var/lib/pgsql/data-upgrade/
/etc/init.d/postgresql initdb
cp -v /var/lib/pgsql/data-upgrade/*conf /var/lib/pgsql/data/

for depricated in bgwriter_lru_percent
do
    while egrep -q ^$depricated /var/lib/pgsql/data/postgresql.conf
    do
        echo $depricated still exists in /var/lib/pgsql/data/postgresql.conf  You are using an old config
        sleep 1
    done
done
echo
echo "restarting postgres"
/etc/init.d/postgresql restart
echo
echo "starting import"
cd /tmp/pgtmp
sudo -u postgres ./restore.sh
echo
echo "followup comparisons"
echo fas2

echo "select count(*) from people;" | sudo -u postgres psql fas2
echo bodhi
echo "select count(*) from package;" | sudo -u postgres psql bodhi
echo elections
echo "select count(*) from elections;" | sudo -u postgres psql elections
echo pkgdb
echo "select count(*) from package;" | sudo -u postgres psql pkgdb
echo mirrormanager
echo "select count(*) from host;" | sudo -u postgres psql mirrormanager

echo
echo If everything looks good restart iptables

comment:2 Changed 5 years ago by mmcgrath

  • Resolution set to fixed
  • Status changed from assigned to closed

This completed without a hitch.

Note: See TracTickets for help on using tickets.