NTNX>日記

個人的な趣味による Nutanix Community Edition 日記。Japanese のみですみません。

NDB で PostgreSQL DB サーバ に OS パッチを適用してみる。

Nutanix Database Service(NDB)には、DB サーバ VM の OS パッチ適用機能で、PostgreSQL DB サーバ VM をアップデートしてみます。

構成のイメージです。

今回の環境

下記の投稿にある手順で作成した DB サーバ VM に、パッチを適用します。

パッチ適用対象にする DB サーバの IP アドレスは、192.168.11.136 です。

DB サーバ に SSH 接続して、様子を確認しておきます。

[root@lab-linux-02 ~]# ssh -i .ssh/id_rsa era@192.168.11.136

OS は、CentOS 7 でした。

[era@ndb-pgsql-sv-02 ~]$ cat /etc/system-release
CentOS Linux release 7.9.2009 (Core)

PostgreSQL DB インスタンスは起動されている状態です。

[era@ndb-pgsql-sv-02 ~]$ ps -ef | grep postgres
postgres   7386      1  0 12:49 ?        00:00:00 /usr/pgsql-10.4/bin/postmaster -D /pgsql/pgsql-02/data
postgres   7390   7386  0 12:49 ?        00:00:00 postgres: logger process
postgres   7392   7386  0 12:49 ?        00:00:00 postgres: checkpointer process
postgres   7393   7386  0 12:49 ?        00:00:00 postgres: writer process
postgres   7394   7386  0 12:49 ?        00:00:00 postgres: wal writer process
postgres   7395   7386  0 12:49 ?        00:00:00 postgres: autovacuum launcher process
postgres   7396   7386  0 12:49 ?        00:00:00 postgres: archiver process   last was 000000010000000000000002.00000028.backup
postgres   7397   7386  0 12:49 ?        00:00:00 postgres: stats collector process
postgres   7398   7386  0 12:49 ?        00:00:00 postgres: bgworker: logical replication launcher
era       16462  16150  0 13:56 pts/0    00:00:00 grep --color=auto postgres

RPM パッケージは、そこそこアップデートが必要になっています。

[era@ndb-pgsql-sv-02 ~]$ yum check-update
読み込んだプラグイン:fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.riken.jp
 * elrepo: ftp.ne.jp
 * epel: ftp.riken.jp
 * extras: ftp.riken.jp
 * updates: ftp.riken.jp

bash.x86_64                           4.2.46-35.el7_9                updates
bind-export-libs.x86_64               32:9.11.4-26.P2.el7_9.10       updates
bind-libs-lite.x86_64                 32:9.11.4-26.P2.el7_9.10       updates
bind-license.noarch                   32:9.11.4-26.P2.el7_9.10       updates
binutils.x86_64                       2.27-44.base.el7_9.1           updates
ca-certificates.noarch                2022.2.54-74.el7_9             updates
cronie.x86_64                         1.4.11-24.el7_9                updates
cronie-anacron.x86_64                 1.4.11-24.el7_9                updates
cyrus-sasl-lib.x86_64                 2.1.26-24.el7_9                updates
device-mapper.x86_64                  7:1.02.170-6.el7_9.5           updates
device-mapper-event.x86_64            7:1.02.170-6.el7_9.5           updates
device-mapper-event-libs.x86_64       7:1.02.170-6.el7_9.5           updates
device-mapper-libs.x86_64             7:1.02.170-6.el7_9.5           updates
dhclient.x86_64                       12:4.2.5-83.el7.centos.1       updates
dhcp-common.x86_64                    12:4.2.5-83.el7.centos.1       updates
dhcp-libs.x86_64                      12:4.2.5-83.el7.centos.1       updates
dmidecode.x86_64                      1:3.2-5.el7_9.1                updates
elrepo-release.noarch                 7.0-6.el7.elrepo               elrepo
epel-release.noarch                   7-14                           epel
expat.x86_64                          2.1.0-15.el7_9                 updates
firewalld.noarch                      0.6.3-13.el7_9                 updates
firewalld-filesystem.noarch           0.6.3-13.el7_9                 updates
glib2.x86_64                          2.56.1-9.el7_9                 updates
glibc.x86_64                          2.17-326.el7_9                 updates
glibc-common.x86_64                   2.17-326.el7_9                 updates
glibc-devel.x86_64                    2.17-326.el7_9                 updates
glibc-headers.x86_64                  2.17-326.el7_9                 updates
grub2.x86_64                          1:2.02-0.87.0.2.el7.centos.11  updates
grub2-common.noarch                   1:2.02-0.87.0.2.el7.centos.11  updates
grub2-pc.x86_64                       1:2.02-0.87.0.2.el7.centos.11  updates
grub2-pc-modules.noarch               1:2.02-0.87.0.2.el7.centos.11  updates
grub2-tools.x86_64                    1:2.02-0.87.0.2.el7.centos.11  updates
grub2-tools-extra.x86_64              1:2.02-0.87.0.2.el7.centos.11  updates
grub2-tools-minimal.x86_64            1:2.02-0.87.0.2.el7.centos.11  updates
gssproxy.x86_64                       0.7.0-30.el7_9                 updates
gzip.x86_64                           1.5-11.el7_9                   updates
iscsi-initiator-utils.x86_64          6.2.0.874-22.el7_9             updates
iscsi-initiator-utils-iscsiuio.x86_64 6.2.0.874-22.el7_9             updates
iwl100-firmware.noarch                39.31.5.1-80.el7_9             updates
iwl1000-firmware.noarch               1:39.31.5.1-80.el7_9           updates
iwl105-firmware.noarch                18.168.6.1-80.el7_9            updates
iwl135-firmware.noarch                18.168.6.1-80.el7_9            updates
iwl2000-firmware.noarch               18.168.6.1-80.el7_9            updates
iwl2030-firmware.noarch               18.168.6.1-80.el7_9            updates
iwl3160-firmware.noarch               25.30.13.0-80.el7_9            updates
iwl3945-firmware.noarch               15.32.2.9-80.el7_9             updates
iwl4965-firmware.noarch               228.61.2.24-80.el7_9           updates
iwl5000-firmware.noarch               8.83.5.1_1-80.el7_9            updates
iwl5150-firmware.noarch               8.24.2.2-80.el7_9              updates
iwl6000-firmware.noarch               9.221.4.1-80.el7_9             updates
iwl6000g2a-firmware.noarch            18.168.6.1-80.el7_9            updates
iwl6000g2b-firmware.noarch            18.168.6.1-80.el7_9            updates
iwl6050-firmware.noarch               41.28.5.1-80.el7_9             updates
iwl7260-firmware.noarch               25.30.13.0-80.el7_9            updates
kbd.x86_64                            1.15.5-16.el7_9                updates
kbd-legacy.noarch                     1.15.5-16.el7_9                updates
kbd-misc.noarch                       1.15.5-16.el7_9                updates
kernel.x86_64                         3.10.0-1160.81.1.el7           updates
kernel-headers.x86_64                 3.10.0-1160.81.1.el7           updates
kernel-tools.x86_64                   3.10.0-1160.81.1.el7           updates
kernel-tools-libs.x86_64              3.10.0-1160.81.1.el7           updates
kexec-tools.x86_64                    2.0.15-51.el7_9.3              updates
kpartx.x86_64                         0.4.9-136.el7_9                updates
krb5-devel.x86_64                     1.15.1-55.el7_9                updates
krb5-libs.x86_64                      1.15.1-55.el7_9                updates
libblkid.x86_64                       2.23.2-65.el7_9.1              updates
libkadm5.x86_64                       1.15.1-55.el7_9                updates
libmount.x86_64                       2.23.2-65.el7_9.1              updates
libpcap.x86_64                        14:1.5.3-13.el7_9              updates
libsmartcols.x86_64                   2.23.2-65.el7_9.1              updates
libuuid.x86_64                        2.23.2-65.el7_9.1              updates
libxml2.x86_64                        2.9.1-6.el7_9.6                updates
libxml2-devel.x86_64                  2.9.1-6.el7_9.6                updates
libzstd.x86_64                        1.5.2-1.el7                    epel
linux-firmware.noarch                 20200421-80.git78c0348.el7_9   updates
lvm2.x86_64                           7:2.02.187-6.el7_9.5           updates
lvm2-libs.x86_64                      7:2.02.187-6.el7_9.5           updates
microcode_ctl.x86_64                  2:2.1-73.15.el7_9              updates
net-snmp-agent-libs.x86_64            1:5.7.2-49.el7_9.2             updates
net-snmp-libs.x86_64                  1:5.7.2-49.el7_9.2             updates
nfs-utils.x86_64                      1:1.3.0-0.68.el7.2             updates
nspr.x86_64                           4.34.0-3.1.el7_9               updates
nss.x86_64                            3.79.0-4.el7_9                 updates
nss-softokn.x86_64                    3.79.0-4.el7_9                 updates
nss-softokn-freebl.x86_64             3.79.0-4.el7_9                 updates
nss-sysinit.x86_64                    3.79.0-4.el7_9                 updates
nss-tools.x86_64                      3.79.0-4.el7_9                 updates
nss-util.x86_64                       3.79.0-1.el7_9                 updates
open-vm-tools.x86_64                  11.0.5-3.el7_9.4               updates
openldap.x86_64                       2.4.44-25.el7_9                updates
openssh.x86_64                        7.4p1-22.el7_9                 updates
openssh-clients.x86_64                7.4p1-22.el7_9                 updates
openssh-server.x86_64                 7.4p1-22.el7_9                 updates
openssl.x86_64                        1:1.0.2k-25.el7_9              updates
openssl-devel.x86_64                  1:1.0.2k-25.el7_9              updates
openssl-libs.x86_64                   1:1.0.2k-25.el7_9              updates
perl.x86_64                           4:5.16.3-299.el7_9             updates
perl-Pod-Escapes.noarch               1:1.04-299.el7_9               updates
perl-libs.x86_64                      4:5.16.3-299.el7_9             updates
perl-macros.x86_64                    4:5.16.3-299.el7_9             updates
pgbackrest.x86_64                     2.43-1.rhel7                   pgdg-common
pgdg-redhat-repo.noarch               42.0-28                        pgdg-common
polkit.x86_64                         0.112-26.el7_9.1               updates
postgresql10-libs.x86_64              10.23-1PGDG.rhel7              pgdg10
python.x86_64                         2.7.5-92.el7_9                 updates
python-devel.x86_64                   2.7.5-92.el7_9                 updates
python-firewall.noarch                0.6.3-13.el7_9                 updates
python-libs.x86_64                    2.7.5-92.el7_9                 updates
python-perf.x86_64                    3.10.0-1160.81.1.el7           updates
rpm.x86_64                            4.11.3-48.el7_9                updates
rpm-build-libs.x86_64                 4.11.3-48.el7_9                updates
rpm-libs.x86_64                       4.11.3-48.el7_9                updates
rpm-python.x86_64                     4.11.3-48.el7_9                updates
rsync.x86_64                          3.1.2-12.el7_9                 updates
rsyslog.x86_64                        8.24.0-57.el7_9.3              updates
sudo.x86_64                           1.8.23-10.el7_9.2              updates
systemd.x86_64                        219-78.el7_9.7                 updates
systemd-libs.x86_64                   219-78.el7_9.7                 updates
systemd-sysv.x86_64                   219-78.el7_9.7                 updates
tuned.noarch                          2.11.0-12.el7_9                updates
tzdata.noarch                         2022g-1.el7                    updates
unzip.x86_64                          6.0-24.el7_9                   updates
util-linux.x86_64                     2.23.2-65.el7_9.1              updates
vim-minimal.x86_64                    2:7.4.629-8.el7_9              updates
virt-what.x86_64                      1.18-4.el7_9.1                 updates
wpa_supplicant.x86_64                 1:2.6-12.el7_9.2               updates
xz.x86_64                             5.2.2-2.el7_9                  updates
xz-devel.x86_64                       5.2.2-2.el7_9                  updates
xz-libs.x86_64                        5.2.2-2.el7_9                  updates
zlib.x86_64                           1.2.7-20.el7_9                 updates
zlib-devel.x86_64                     1.2.7-20.el7_9                 updates
[era@ndb-pgsql-sv-02 ~]$

PostgreSQL Yum リポジトリの除外

NDB での OS パッチ適用処理中に、DBMS ソフトウェアの Yum リポジトリが設定されているとエラーになり失敗するので、事前に除外しておきます。

デフォルトの Yum リポジトリ登録は下記のように、PostgreSQL のリポジトリが含まれています。

[era@ndb-pgsql-sv-02 ~]$ yum -q repolist
リポジトリー ID          リポジトリー名                                             状態
base/7/x86_64            CentOS-7 - Base                                            10,072
elrepo                   ELRepo.org Community Enterprise Linux Repository - el7        148
epel/x86_64              Extra Packages for Enterprise Linux 7 - x86_64             13,732
extras/7/x86_64          CentOS-7 - Extras                                             515
pgdg-common/7/x86_64     PostgreSQL common RPMs for RHEL/CentOS 7 - x86_64             384
pgdg10/7/x86_64          PostgreSQL 10 for RHEL/CentOS 7 - x86_64                    1,153
pgdg11/7/x86_64          PostgreSQL 11 for RHEL/CentOS 7 - x86_64                    1,398
pgdg12/7/x86_64          PostgreSQL 12 for RHEL/CentOS 7 - x86_64                    1,008
pgdg95/7/x86_64          PostgreSQL 9.5 for RHEL/CentOS 7 - x86_64                     763
pgdg96/7/x86_64          PostgreSQL 9.6 for RHEL/CentOS 7 - x86_64                     964
updates/7/x86_64         CentOS-7 - Updates                                          4,538

PostgreSQL の .repo ファイルを退避しておきます。

[era@ndb-pgsql-sv-02 ~]$ sudo mv /etc/yum.repos.d/pgdg-redhat-all.repo /etc/yum.repos.d/pg
dg-redhat-all.repo.bk

これで、DBMS ソフトウェアの Yum リポジトリが参照されなくなりました。

[era@ndb-pgsql-sv-02 ~]$ yum -q repolist
リポジトリー ID        リポジトリー名                                               状態
base/7/x86_64          CentOS-7 - Base                                              10,072
elrepo                 ELRepo.org Community Enterprise Linux Repository - el7          148
epel/x86_64            Extra Packages for Enterprise Linux 7 - x86_64               13,732
extras/7/x86_64        CentOS-7 - Extras                                               515
updates/7/x86_64       CentOS-7 - Updates                                            4,538

OS パッチの適用

NDB の Web UI から、DB サーバに OS パッチを適用します。今回はメンテンナンス ウィンドウは利用せず、手動でパッチ適用を開始します。

「データベース サーバー VM」画面で対象サーバの画面を開いて、「アクション」→「Patch Now」をクリックします。

「オペレーティング システム パッチ適用」のチェックが ON になっている(そして OFF にはできない)ので、そのまま「更新」をクリックします。

パッチ適用処理が開始されたので、ステータスを確認します。

処理の完了をひたすら待ちます。処理の中で、DB の停止、OS の再起動、DB の起動なども実施されることがわかります。今回の DB サーバはクラスタ構成ではないので、この間は DB が利用できない状態になります。

少し待つと、パッチ適用が完了します。

「データベース サーバー VM」画面で、パッチを適用したサーバのページを開くと、「パッチ」→「最終適用」に前回適用のタイムスタンプが表示されるようになります。

ちなみに NDB での OS パッチ適用では、意図せず DBMS ソフトウェアのアップデートをしないように、アップデート対象の RPM に DBMS ソフトウェアのものが含まれるとエラーになります。そこで今回は、事前に PostgreSQL の Yum リポジトリを除外していました。

以上。

©2023 gowatana
クリエイティブ・コモンズ・ライセンスこの 作品 は クリエイティブ・コモンズ 表示 4.0 国際 ライセンスの下に提供されています。