Choco Soft

Nadesiko DE RDB

Choco Soft header image 2

LinuxでのPostgreSQLのアップデート

2016年04月08日 · コメント(0) · Pervasive.SQL, Server

仕事で「9.4.1」を使っていたのですが、どうも不具合があるっぽいのでアップデートをしようと思ったら、ググっても意外に出て来なかったのでメモ。

【目的】
データベース「PostgreSQL」のリビジョンを新しいものにする事により、既知の不具合を解消する。

対象のPostgreSQL
現行:9.4.1 64
⇒9.4.7 64

【手順】
1.対象サーバーにSSHでログインする。
2.スーパーユーザー(SU)権限になる。

3.Yumチェック
>yum -check-update
postgresql94.x86_64 9.4.7-1PGDG.rhel6 pgdg94
postgresql94-contrib.x86_64 9.4.7-1PGDG.rhel6 pgdg94
postgresql94-libs.x86_64 9.4.7-1PGDG.rhel6 pgdg94
postgresql94-odbc.x86_64 09.03.0400-1PGDG.rhel6 pgdg94
postgresql94-server.x86_64 9.4.7-1PGDG.rhel6 pgdg94

4.Apacheを停止
>/etc/init.d/httpd stop

5.PostgreSQLのバックアップを取る。
・データバックアップ
>su postgres
bash-4.1$ pg_dumpall -o > pg_dumpall20160407

6.PostgreSQLの停止
su postgres
bash-4.1$ /usr/pgsql-9.4/bin/pg_ctl -D /var/lib/pgsql/9.4/data stop

7.PostgreSQLを抜ける
bash-4.1$ exit

8.アップデート開始
>yum update postgresql94.x86_64

================================================================================
パッケージ アーキテクチャ
バージョン リポジトリー
容量
================================================================================
更新:
postgresql94 x86_64 9.4.7-1PGDG.rhel6 pgdg94 1.0 M
依存性関連での更新をします。:
postgresql94-contrib x86_64 9.4.7-1PGDG.rhel6 pgdg94 532 k
postgresql94-libs x86_64 9.4.7-1PGDG.rhel6 pgdg94 195 k
postgresql94-server x86_64 9.4.7-1PGDG.rhel6 pgdg94 4.4 M

総ダウンロード容量: 6.1 M
これでいいですか? [y/N]y

9.実行(yキーを押す)
(1/4): postgresql94-9.4.7-1PGDG.rhel6.x86_64.rpm | 1.0 MB 00:01
(2/4): postgresql94-contrib-9.4.7-1PGDG.rhel6.x86_64.rpm | 532 kB 00:00
(3/4): postgresql94-libs-9.4.7-1PGDG.rhel6.x86_64.rpm | 195 kB 00:00
(4/4): postgresql94-server-9.4.7-1PGDG.rhel6.x86_64.rpm | 4.4 MB 00:01

上記更新プログラムがダウンロード

>完了しました!が表示される。

10.PostgreSQLの開始
⇒不要でした。
su postgres
bash-4.1$ /usr/pgsql-9.4/bin/pg_ctl -D /var/lib/pgsql/9.4/data start

アップデートが完了すると自動起動してるらしい。

念のため、リスタートをかけた。
>/usr/pgsql-9.4/bin/pg_ctl -D /var/lib/pgsql/9.4/data restart

PostgreSQLを抜ける
bash-4.1$ exit

11.Apacheを起動
>/etc/init.d/httpd start
完了

12.URLを確認

ご案内

おわり。

タグ :

コメント(0)

コメントを受け付けておりません。