RHEL8 の MariaDB 10.3 で運用中のサーバーに Zabbix 6.0 LTS を導入することになった。
システム要求が MariaDB 10.5 なのでアップグレードした手順を記録しておきます。
バックアップ
先ずはバックアップを取ります。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | #!/bin/bash PATH=/usr/local/sbin:/usr/bin:/bin # バックアップ先ディレクトリ BACKDIR=/backup/mysql # MySQLrootパスワード ROOTPASS=xxxxxxxx # バックアップ先ディレクトリ再作成 rm -rf $BACKDIR mkdir -p $BACKDIR # データベース名取得 DBLIST=`ls -p /var/lib/mysql | grep / | tr -d /` # データベースごとにバックアップ for dbname in $DBLIST do [ $dbname = "performance_schema" ] && continue table_count=`mysql -u root -p$ROOTPASS -B -e "show tables" $dbname|wc -l` [ $table_count -ne 0 ] && mysqldump --events -u root -p$ROOTPASS $dbname > $BACKDIR/$dbname.sql | logger -t mysqldump done |
スクリプトは下記のサイトのコピペです。今回は mysqldump でやりましたが phpMyAdmin でエクスポートするのも、お手軽で良いかもしれません。
MySQLデータベース自動バックアップ運用(mysqldump) - CentOSで自宅サーバー構築
MySQL繝
MariaDB の入れ替え
MariaDB のストリームを確認
1 2 3 4 5 6 7 8 9 10 11 12 | # dnf module list mariadb Updating Subscription Management repositories. This system is registered with an entitlement server, but is not receiving updates. You can use subscription-manager to assign subscriptions. Last metadata expiration check: 2:38:52 ago on Tue 19 Jul 2022 01:12:17 PM JST. Red Hat Enterprise Linux 8 for x86_64 - AppStream from RHUI (RPMs) Name Stream Profiles Summary mariadb 10.3 [d][e] client, galera, server [d] MariaDB Module mariadb 10.5 client, galera, server [d] MariaDB Module Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled |
MariaDB のストリームを確認したところ、10.3 と 10.5 が候補にあります。
ストリームの切り替え
他のバージョンに切り替えたい場合は、一旦リセットします。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | # dnf module reset mariadb Updating Subscription Management repositories. This system is registered with an entitlement server, but is not receiving updates. You can use subscription-manager to assign subscriptions. Last metadata expiration check: 0:16:55 ago on Tue 19 Jul 2022 05:09:25 PM JST. Dependencies resolved. ============================================================================================================================================================= Package Architecture Version Repository Size ============================================================================================================================================================= Resetting modules: mariadb Transaction Summary ============================================================================================================================================================= Is this ok [y/N]: y Complete! |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | # dnf module install mariadb:10.5 Updating Subscription Management repositories. This system is registered with an entitlement server, but is not receiving updates. You can use subscription-manager to assign subscriptions. Last metadata expiration check: 0:17:41 ago on Tue 19 Jul 2022 05:09:25 PM JST. Dependencies resolved. ============================================================================================================================================================= Package Architecture Version Repository Size ============================================================================================================================================================= Upgrading: mariadb x86_64 3:10.5.13-1.module+el8.5.0+14125+d11efe18 rhel-8-appstream-rhui-rpms 6.2 M mariadb-backup x86_64 3:10.5.13-1.module+el8.5.0+14125+d11efe18 rhel-8-appstream-rhui-rpms 6.9 M mariadb-common x86_64 3:10.5.13-1.module+el8.5.0+14125+d11efe18 rhel-8-appstream-rhui-rpms 68 k mariadb-errmsg x86_64 3:10.5.13-1.module+el8.5.0+14125+d11efe18 rhel-8-appstream-rhui-rpms 240 k mariadb-gssapi-server x86_64 3:10.5.13-1.module+el8.5.0+14125+d11efe18 rhel-8-appstream-rhui-rpms 56 k mariadb-server x86_64 3:10.5.13-1.module+el8.5.0+14125+d11efe18 rhel-8-appstream-rhui-rpms 18 M mariadb-server-utils x86_64 3:10.5.13-1.module+el8.5.0+14125+d11efe18 rhel-8-appstream-rhui-rpms 1.2 M Installing dependencies: mysql-selinux noarch 1.0.2-6.el8 rhel-8-appstream-rhui-rpms 37 k Installing module profiles: mariadb/server Enabling module streams: mariadb 10.5 Transaction Summary ============================================================================================================================================================= Install 1 Package Upgrade 7 Packages Total download size: 33 M Is this ok [y/N]: y Downloading Packages: (1/8): mysql-selinux-1.0.2-6.el8.noarch.rpm 952 kB/s | 37 kB 00:00 (2/8): mariadb-gssapi-server-10.5.13-1.module+el8.5.0+14125+d11efe18.x86_64.rpm 861 kB/s | 56 kB 00:00 (3/8): mariadb-10.5.13-1.module+el8.5.0+14125+d11efe18.x86_64.rpm 59 MB/s | 6.2 MB 00:00 (4/8): mariadb-common-10.5.13-1.module+el8.5.0+14125+d11efe18.x86_64.rpm 1.5 MB/s | 68 kB 00:00 (5/8): mariadb-errmsg-10.5.13-1.module+el8.5.0+14125+d11efe18.x86_64.rpm 8.2 MB/s | 240 kB 00:00 (6/8): mariadb-server-utils-10.5.13-1.module+el8.5.0+14125+d11efe18.x86_64.rpm 25 MB/s | 1.2 MB 00:00 (7/8): mariadb-backup-10.5.13-1.module+el8.5.0+14125+d11efe18.x86_64.rpm 65 MB/s | 6.9 MB 00:00 (8/8): mariadb-server-10.5.13-1.module+el8.5.0+14125+d11efe18.x86_64.rpm 54 MB/s | 18 MB 00:00 ------------------------------------------------------------------------------------------------------------------------------------------------------------- Total 56 MB/s | 33 MB 00:00 Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Running scriptlet: mariadb-common-3:10.5.13-1.module+el8.5.0+14125+d11efe18.x86_64 1/1 Upgrading : mariadb-common-3:10.5.13-1.module+el8.5.0+14125+d11efe18.x86_64 1/15 Upgrading : mariadb-errmsg-3:10.5.13-1.module+el8.5.0+14125+d11efe18.x86_64 2/15 Running scriptlet: mysql-selinux-1.0.2-6.el8.noarch 3/15 Installing : mysql-selinux-1.0.2-6.el8.noarch 3/15 Running scriptlet: mysql-selinux-1.0.2-6.el8.noarch 3/15 libsemanage.semanage_direct_install_info: Overriding mysql module at lower priority 100 with module at priority 200. Upgrading : mariadb-gssapi-server-3:10.5.13-1.module+el8.5.0+14125+d11efe18.x86_64 4/15 Upgrading : mariadb-3:10.5.13-1.module+el8.5.0+14125+d11efe18.x86_64 5/15 Upgrading : mariadb-server-utils-3:10.5.13-1.module+el8.5.0+14125+d11efe18.x86_64 6/15 Upgrading : mariadb-backup-3:10.5.13-1.module+el8.5.0+14125+d11efe18.x86_64 7/15 Running scriptlet: mariadb-server-3:10.5.13-1.module+el8.5.0+14125+d11efe18.x86_64 8/15 Upgrading : mariadb-server-3:10.5.13-1.module+el8.5.0+14125+d11efe18.x86_64 8/15 warning: /etc/my.cnf.d/mariadb-server.cnf created as /etc/my.cnf.d/mariadb-server.cnf.rpmnew Running scriptlet: mariadb-server-3:10.5.13-1.module+el8.5.0+14125+d11efe18.x86_64 8/15 Cleanup : mariadb-3:10.3.32-2.module+el8.5.0+14124+14ced695.x86_64 9/15 Running scriptlet: mariadb-server-3:10.3.32-2.module+el8.5.0+14124+14ced695.x86_64 10/15 Cleanup : mariadb-server-3:10.3.32-2.module+el8.5.0+14124+14ced695.x86_64 10/15 Running scriptlet: mariadb-server-3:10.3.32-2.module+el8.5.0+14124+14ced695.x86_64 10/15 Cleanup : mariadb-gssapi-server-3:10.3.32-2.module+el8.5.0+14124+14ced695.x86_64 11/15 Cleanup : mariadb-errmsg-3:10.3.32-2.module+el8.5.0+14124+14ced695.x86_64 12/15 Cleanup : mariadb-common-3:10.3.32-2.module+el8.5.0+14124+14ced695.x86_64 13/15 Cleanup : mariadb-backup-3:10.3.32-2.module+el8.5.0+14124+14ced695.x86_64 14/15 Cleanup : mariadb-server-utils-3:10.3.32-2.module+el8.5.0+14124+14ced695.x86_64 15/15 Running scriptlet: mysql-selinux-1.0.2-6.el8.noarch 15/15 Running scriptlet: mariadb-server-utils-3:10.3.32-2.module+el8.5.0+14124+14ced695.x86_64 15/15 Verifying : mysql-selinux-1.0.2-6.el8.noarch 1/15 Verifying : mariadb-gssapi-server-3:10.5.13-1.module+el8.5.0+14125+d11efe18.x86_64 2/15 Verifying : mariadb-gssapi-server-3:10.3.32-2.module+el8.5.0+14124+14ced695.x86_64 3/15 Verifying : mariadb-3:10.5.13-1.module+el8.5.0+14125+d11efe18.x86_64 4/15 Verifying : mariadb-3:10.3.32-2.module+el8.5.0+14124+14ced695.x86_64 5/15 Verifying : mariadb-server-3:10.5.13-1.module+el8.5.0+14125+d11efe18.x86_64 6/15 Verifying : mariadb-server-3:10.3.32-2.module+el8.5.0+14124+14ced695.x86_64 7/15 Verifying : mariadb-common-3:10.5.13-1.module+el8.5.0+14125+d11efe18.x86_64 8/15 Verifying : mariadb-common-3:10.3.32-2.module+el8.5.0+14124+14ced695.x86_64 9/15 Verifying : mariadb-server-utils-3:10.5.13-1.module+el8.5.0+14125+d11efe18.x86_64 10/15 Verifying : mariadb-server-utils-3:10.3.32-2.module+el8.5.0+14124+14ced695.x86_64 11/15 Verifying : mariadb-errmsg-3:10.5.13-1.module+el8.5.0+14125+d11efe18.x86_64 12/15 Verifying : mariadb-errmsg-3:10.3.32-2.module+el8.5.0+14124+14ced695.x86_64 13/15 Verifying : mariadb-backup-3:10.5.13-1.module+el8.5.0+14125+d11efe18.x86_64 14/15 Verifying : mariadb-backup-3:10.3.32-2.module+el8.5.0+14124+14ced695.x86_64 15/15 Installed products updated. Upgraded: mariadb-3:10.5.13-1.module+el8.5.0+14125+d11efe18.x86_64 mariadb-backup-3:10.5.13-1.module+el8.5.0+14125+d11efe18.x86_64 mariadb-common-3:10.5.13-1.module+el8.5.0+14125+d11efe18.x86_64 mariadb-errmsg-3:10.5.13-1.module+el8.5.0+14125+d11efe18.x86_64 mariadb-gssapi-server-3:10.5.13-1.module+el8.5.0+14125+d11efe18.x86_64 mariadb-server-3:10.5.13-1.module+el8.5.0+14125+d11efe18.x86_64 mariadb-server-utils-3:10.5.13-1.module+el8.5.0+14125+d11efe18.x86_64 Installed: mysql-selinux-1.0.2-6.el8.noarch Complete! |
バージョンの確認
1 2 3 4 5 6 7 8 9 10 11 12 | # dnf module list mariadb Updating Subscription Management repositories. This system is registered with an entitlement server, but is not receiving updates. You can use subscription-manager to assign subscriptions. Last metadata expiration check: 0:35:02 ago on Tue 19 Jul 2022 05:09:25 PM JST. Red Hat Enterprise Linux 8 for x86_64 - AppStream from RHUI (RPMs) Name Stream Profiles Summary mariadb 10.3 [d] client, galera, server [d] MariaDB Module mariadb 10.5 [e] client, galera, server [d] [i] MariaDB Module Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled |
[e]nabled が 10.5 に切り替わり、プロファイルも [i]nstalled になりました。
1 2 | # mysql -V mysql Ver 15.1 Distrib 10.5.13-MariaDB, for Linux (x86_64) using EditLine wrapper |
まとめ
MariaDB 10.3 のサポートは 2023 年 5 月で終了するので、それまでに切り替えておきましょう。
コメント