MariaDBを10.7.8から11.0.2にアップグレードした。

サーバーのパッケージをupdateしようとしたら以下のエラーがでてupdate出来なかった。

# dnf check-update
MariaDB Server 371 B/s | 327 B 00:00
Errors during downloading metadata for repository 'mariadb-main':
- Status code: 404 for https://dlm.mariadb.com/repo/mariadb-server/10.7/yum/rhel/8/x86_64/repodata/e3833871afca2d811714f593ca811a49aa164403fe90dce8fa162127d4accbaa-updateinfo.xml.gz (IP: 2606:4700::6812:8718)
- Status code: 404 for https://dlm.mariadb.com/repo/mariadb-server/10.7/yum/rhel/8/x86_64/repodata/222709914d36d4a0fd607616111adc273a0822b3d990597747cb4aac88c80396-primary.xml.gz (IP: 2606:4700::6812:8718)
- Status code: 404 for https://dlm.mariadb.com/repo/mariadb-server/10.7/yum/rhel/8/x86_64/repodata/87f4cced936ba0b45379e14a9a76e20837bdffcfff567065bc344e9af1fb6e4c-filelists.xml.gz (IP: 2606:4700::6812:8718)
Error: Failed to download metadata for repo 'mariadb-main': Yum repo downloading error: Downloading error(s): repodata/87f4cced936ba0b45379e14a9a76e20837bdffcfff567065bc344e9af1fb6e4c-filelists.xml.gz - Cannot download, all mirrors were already tried without success; repodata/e3833871afca2d811714f593ca811a49aa164403fe90dce8fa162127d4accbaa-updateinfo.xml.gz - Cannot download, all mirrors were already tried without success; repodata/222709914d36d4a0fd607616111adc273a0822b3d990597747cb4aac88c80396-primary.xml.gz - Cannot download, all mirrors were already tried without success

mariadbのリポジトリのリンクが切れてるようなので調べてみると
mariadb 10.7系はEOLを迎えていたようだ・・・。

と言う事で最新のmariadbにアップグレードしてみました。
まずは、DBのバックアップをします。
# mysqldump -h localhost -u root -p --all-databases > 20230617.sql

次に最新のリポジトリに入れ替えます。
# curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash
# [info] Checking for script prerequisites.
# [warning] Found existing file at /etc/yum.repos.d/mariadb.repo. Moving to /etc/yum.repos.d/mariadb.repo.old_1
# [info] MariaDB Server version 11.0 is valid
# [info] Repository file successfully written to /etc/yum.repos.d/mariadb.repo
# [info] Adding trusted package signing keys...
/etc/pki/rpm-gpg ~
~
# [info] Successfully added trusted package signing keys
# [info] Cleaning package cache...
46 files removed

それではupdateします。

# dnf update

******************************************************************
A MySQL or MariaDB server package (MariaDB-server-10.7.8-1.el8.x86_64) is installed.

Upgrading directly from MySQL 10.7 to MariaDB 11.0 may not
be safe in all cases. A manual dump and restore using mysqldump is
recommended. It is important to review the MariaDB manual's Upgrading
section for version-specific incompatibilities.

A manual upgrade is required.

- Ensure that you have a complete, working backup of your data and my.cnf
files
- Shut down the MySQL server cleanly
- Remove the existing MySQL packages. Usually this command will
list the packages you should remove:
rpm -qa | grep -i '^mysql-'

You may choose to use 'rpm --nodeps -ev ' to remove
the package which contains the mysqlclient shared library. The
library will be reinstalled by the MariaDB-shared package.
- Install the new MariaDB packages supplied by MariaDB Foundation
- Ensure that the MariaDB server is started
- Run the 'mysql_upgrade' program

This is a brief description of the upgrade process. Important details
can be found in the MariaDB manual, in the Upgrading section.
******************************************************************
error: %prein(MariaDB-server-11.0.2-1.el8.x86_64) scriptlet failed, exit status 1

Error in PREIN scriptlet in rpm package MariaDB-server
Upgrading : php-fpm-8.1.20-1.el8.remi.x86_64 10/32
error: MariaDB-server-11.0.2-1.el8.x86_64: install failed

一緒にphpもupdateされています。 
大半のmariadbパッケージはupdateできましたが
MariaDB-server-10.7.8-1.el8.x86_64は
表示されている警告文にもある様に安全の為updateしてくれないようです。
dumpは既に行っていますので、updateを続けます。

現在のmariadb関連のパッケージを確認
# rpm -qa | grep -i '^MariaDB-'
MariaDB-common-11.0.2-1.el8.x86_64
MariaDB-client-11.0.2-1.el8.x86_64
MariaDB-shared-11.0.2-1.el8.x86_64
MariaDB-server-10.7.8-1.el8.x86_64

MariaDB-serverが古いのでこれを削除して11.0.2-1を入れます。

依存関係で他にも削除されますが気にしません。
# dnf remove MariaDB-server-10.7.8-1.el8.x86_64
Dependencies resolved.
================================================================================
Package Arch Version Repository Size
================================================================================
Removing:
MariaDB-server x86_64 10.7.8-1.el8 @mariadb-main 121 M
Removing unused dependencies:
galera-4 x86_64 26.4.14-1.el8 @mariadb 62 M
lsof x86_64 4.93.2-1.el8 @baseos 623 k
socat x86_64 1.7.4.1-1.el8 @appstream 1.2 M

Transaction Summary
================================================================================
Remove 4 Packages

再度インストールを実施
# dnf -y update
Last metadata expiration check: 0:14:14 ago on Sat 17 Jun 2023 09:27:42 PM JST.
Dependencies resolved.
Nothing to do.
Complete!
[root@higherhope ~]# dnf install MariaDB-server
Last metadata expiration check: 0:14:28 ago on Sat 17 Jun 2023 09:27:42 PM JST.
Dependencies resolved.
================================================================================
Package Architecture Version Repository Size
================================================================================
Installing:
MariaDB-server x86_64 11.0.2-1.el8 mariadb-main 27 M
Installing dependencies:
galera-4 x86_64 26.4.14-1.el8 mariadb 13 M
lsof x86_64 4.93.2-1.el8 baseos 252 k
socat x86_64 1.7.4.1-1.el8 appstream 322 k

Transaction Summary
================================================================================
Install 4 Packages

Total download size: 41 M
Installed size: 42 M
Is this ok [y/N]: y
Downloading Packages:
(1/4): lsof-4.93.2-1.el8.x86_64.rpm 1.2 MB/s | 252 kB 00:00
(2/4): socat-1.7.4.1-1.el8.x86_64.rpm 125 kB/s | 322 kB 00:02
(3/4): galera-4-26.4.14-1.el8.x86_64.rpm 3.6 MB/s | 13 MB 00:03
(4/4): MariaDB-server-11.0.2-1.el8.x86_64.rpm 5.2 MB/s | 27 MB 00:05
--------------------------------------------------------------------------------
Total 5.8 MB/s | 41 MB 00:07
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
Running scriptlet: MariaDB-server-11.0.2-1.el8.x86_64 1/1
Preparing : 1/1
Installing : lsof-4.93.2-1.el8.x86_64 1/4
Installing : socat-1.7.4.1-1.el8.x86_64 2/4
Running scriptlet: galera-4-26.4.14-1.el8.x86_64 3/4
Installing : galera-4-26.4.14-1.el8.x86_64 3/4
Running scriptlet: galera-4-26.4.14-1.el8.x86_64 3/4
Running scriptlet: MariaDB-server-11.0.2-1.el8.x86_64 4/4
Installing : MariaDB-server-11.0.2-1.el8.x86_64 4/4
Running scriptlet: MariaDB-server-11.0.2-1.el8.x86_64 4/4
Verifying : galera-4-26.4.14-1.el8.x86_64 1/4
Verifying : lsof-4.93.2-1.el8.x86_64 2/4
Verifying : socat-1.7.4.1-1.el8.x86_64 3/4
Verifying : MariaDB-server-11.0.2-1.el8.x86_64 4/4

Installed:
MariaDB-server-11.0.2-1.el8.x86_64 galera-4-26.4.14-1.el8.x86_64
lsof-4.93.2-1.el8.x86_64 socat-1.7.4.1-1.el8.x86_64

Complete!

削除されたパッケージも再び入りました。

サービスが停止しているので起動します。
# systemctl start mariadb

バージョン確認
# mariadb --version
mariadb from 11.0.2-MariaDB, client 15.2 for Linux (x86_64) using readline 5.1

無事にMariaDB 11.0.2にバージョンアップ出来ました。

ブックマーク パーマリンク.

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です