Bundan önceki RHN Satellite Schema Upgrade yazımda, Oracle database kullanan RHN satellite sunucularında nasıl upgrade işlemi yapılabileceğinden bahsetmiştim.
Bu yazımda ise Postgresql database kullanan RHN Satellite sunucularının database schema upgrade nin nasıl yapılacağından bahsetmek istiyorum.
Bu işlemi hadi canım sıkıldı, schema upgrade edeyim diye yapmıyorum, aşağıdaki gibi bir uyarı maili geldiği için bu işlemi yapıyorum.
[important]
This is a notice to let you know that there is a satellite-schema
upgrade available for satellite.endersys.com.
Your current satellite-schema version:
5.6.0.10-1.el6sat
Available satellite-schema upgrade:
5.6.0.12-1.el6sat
We recommend to upgrade your satellite-schema at your earliest
convenience to receive latest schema fixes.
Please consult the appropriate errata solution text for detailed
instructions on how to upgrade your satellite-schema.
———————————————————————
This mail is being generated automatically by a daily cron job:
/etc/cron.daily/schema-upgrade-notif
[/important]
Bu işlemi iki farklı yöntem ile gerçekleştirebilirsiniz, 1. yöntem kolay ve uygulaması gereken yöntem, ikinci yöntem ise işin arka planında ne olur ben adım adım kontrol edip yapacağım diyenler için.
1. Yöntem :
Mailin altında da belirtildiği gibi cron job da bu işlem için yazılmış bir script var,
/etc/cron.daily/schema-upgrade-notif
isterseniz otomatik olarak bu script ile işinizi görebilirsiniz.
[important]# bash /etc/cron.daily/schema-upgrade-notif[/important]
Script içeriği şu şekilde,
[important]#!/bin/bash
installed_schema=$(rhn-schema-version 2> /dev/null)
available_schema=$(rpm -q –qf=’%{VERSION}-%{RELEASE}’ satellite-schema)
if [ -z “$installed_schema” ] || [ $installed_schema == $available_schema ]; then
exit;
fi
hostname=$(hostname)
to=$(spacewalk-cfg-get traceback_mail)
mail -s “New satellite-schema upgrade notification from $hostname” $to <<EOB
This is a notice to let you know that there is a satellite-schema
upgrade available for $hostname.
Your current satellite-schema version:
$installed_schema
Available satellite-schema upgrade:
$available_schema
We recommend to upgrade your satellite-schema at your earliest
convenience to receive latest schema fixes.
Please consult the appropriate errata solution text for detailed
instructions on how to upgrade your satellite-schema.
———————————————————————
This mail is being generated automatically by a daily cron job:
/etc/cron.daily/schema-upgrade-notif[/important]
2.Yöntem :
Bu yöntemde ise işlemi adım adım yapıyoruz ve arka planda ne olup bittiğini öğreniyoruz.
Öncelikle mevcut RHN schema versiyonumuza bakalım,
[important]echo $(rhn-schema-version 2> /dev/null)[/important]
5.6.0.12-1.el6sat dan eski olması gerekir, değilse zaten sizin schema güncellenmiş demektir, yapmanız gereken bir işlem bulunmamakta, ancak normal şartlarda
5.6.0.10-1.el6sat görmeniz gerekir.
Erişilebilir schema bilgisine aşağıdaki gibi erişebilirisiniz,
[important] echo $(rpm -q –qf=’%{VERSION}-%{RELEASE}’ satellite-schema)[/important]
Mevcut schema ile erişilebilir schema arasında fark var ise upgrade işlemine başlayabiliriz.
Öncelikle backup alalım;
[important]mkdir /tmp/Backup
chmod 777 /tmp/Backup
rhn-satellite stop
db-control backup /tmp/backup/[/important]
db-control backup komutu database büyüklüğüne bağlı olarak uzun sürebilmektedir.
Backup işlemi tamamlandığında database start ederek upgrade işlemine başlayabiliriz,
[important]
# /etc/init.d/postgresql start
# spacewalk-schema-upgrade
[/important]
Upgrade işleminde çıktı aşağıdaki gibi olmalıdır,
[important][root@satellite ~]# spacewalk-schema-upgrade
You are about to perform upgrade of your satellite-schema.
For general instructions on Red Hat Satellite schema upgrade, please consult
the following article:
https://access.redhat.com/knowledge/articles/273633
Hit Enter to continue or Ctrl+C to interrupt:
Schema upgrade: [satellite-schema-5.6.0.10-1.el6sat] -> [satellite-schema-5.6.0.12-1.el6sat]
Searching for upgrade path: [satellite-schema-5.6.0.10-1] -> [satellite-schema-5.6.0.12-1]
Searching for upgrade path: [satellite-schema-5.6.0.10] -> [satellite-schema-5.6.0.12]
The path: [satellite-schema-5.6.0.10] -> [satellite-schema-5.6.0.12]
Planning to run spacewalk-sql with [/var/log/spacewalk/schema-upgrade/20131211-115010-script.sql]
Plase make sure you have a valid backup of your database before continuing.
Hit Enter to continue or Ctrl+C to interrupt:
Executing spacewalk-sql, the log is in [/var/log/spacewalk/schema-upgrade/20131211-115010-to-satellite-schema-5.6.0.12.log].
The database schema was upgraded to version [satellite-schema-5.6.0.12-1.el6sat].[/important]
Gördüğünüz gibi upgrade işlemi problemsiz sonuçlandı, RHN Satellite start ederek işlemi tamamlayabiliriz.
[important]# rhn-satellite start[/important]
Faydalı olabilmesi temennisi ile.
