0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

ZABBIX5.0LTS→6.0LTS アップデート(Ubuntu 18.04で実施)

Last updated at Posted at 2024-07-09

6.0のLTSが公開されていたので実施しました。
作業順序は下記の公式ドキュメントを元にしています。
前回記事に続き、説明が拙い箇所につきましてはご容赦下さい。また必要の無い処理を行っていたりログをそのまま掲載している箇所もあります。

Zabbixドキュメント6.0
2 DEBIAN / UBUNTU
https://www.zabbix.com/documentation/6.0/jp/manual/installation/upgrade/packages/debian_ubuntu

環境

基盤:AWS EC2
OS:Ubuntu 18.04.5 LTS
MySQL:mysql Ver 8.0.22 for Linux on x86_64 (MySQL Community Server - GPL)
php:PHP 7.2.24-0ubuntu0.18.04.17 (cli) (built: Feb 23 2023 13:29:25) ( NTS )

作業内容

1.AWSコンソールでZABBIX EC2インスタンスのAMIを取得

2.Zabbixプロセスの停止

sudo service zabbix-server stop
sudo service zabbix-agent stop

3.構成ファイルのバックアップ

sudo mkdir /opt/zabbix-backup/ ※前回の4.0→5.0バージョンアップの際にディレクトリ作成済みのため、実際には作成していません
sudo cp /etc/zabbix/zabbix_server.conf /opt/zabbix-backup/zabbix_server.conf_20240501
sudo cp /etc/apache2/conf-enabled/zabbix.conf /opt/zabbix-backup/zabbix.conf_20240501
sudo cp /etc/zabbix/zabbix_agentd.conf /opt/zabbix-backup/zabbix_agentd.conf_20240501
sudo cp -R /usr/share/zabbix/ /opt/zabbix-backup/zabbix20240501
sudo mv zabbix/ zabbix20240501/
sudo mv zabbix-agent/ zabbix-agent20240501/
sudo mv zabbix-release/ zabbix-release20240501/
sudo mv zabbix-frontend-php/ zabbix-frontend-php20240501/
sudo mv zabbix-server-mysql/ zabbix-server-mysql20240501/
sudo cp /etc/zabbix/zabbix_server.conf /opt/zabbix-backup/
sudo cp /etc/apache2/conf-enabled/zabbix.conf /opt/zabbix-backup/
sudo cp -R /usr/share/zabbix/ /opt/zabbix-backup/
sudo cp -R /usr/share/doc/zabbix-* /opt/zabbix-backup/

4.リポジトリの更新とパッケージのダウンロード(Ubuntu 18.04用)
前回(5.0)リポジトリパッケージの削除

sudo rm -Rf /etc/apt/sources.list.d/zabbix.list

新しいリポジトリ構成パッケージをダウンロード

sudo wget https://repo.zabbix.com/zabbix/6.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_6.0-4+ubuntu18.04_all.deb

ダウンロードパッケージの展開

sudo dpkg -i zabbix-release_6.0-4+ubuntu18.04_all.deb
<中略>
設定ファイル '/etc/apt/sources.list.d/zabbix.list'
 ==> これはインストールしてから (あなたかスクリプトによって) 削除されています。
 ==> パッケージ配布元が更新版を提供しています。
   どうしますか? 以下の選択肢があります:
    Y か I  : パッケージメンテナのバージョンをインストールする
    N か O  : 現在インストールされている自分のバージョンを残す
      D     : 両バージョンの差異を表示する
      Z     : 状況を調査するためにシェルを開始する
 デフォルトでは現在使っている自分のバージョンを残します。
*** zabbix.list (Y/I/N/O/D/Z) [デフォルト=N] ? Y
新バージョンの設定ファイル /etc/apt/sources.list.d/zabbix.list をインストールしています ...
新バージョンの設定ファイル /etc/apt/trusted.gpg.d/zabbix-official-repo.gpg をインストールしています ...
<中略>

リポジトリ情報の更新

sudo apt-get update

※PKI(公開鍵基盤)関連のエラーはスルーしても支障ありませんでした

コンポーネントのアップデート

sudo apt-get install --only-upgrade zabbix-server-mysql zabbix-frontend-php zabbix-agent
<中略>
*** zabbix_server.conf (Y/I/N/O/D/Z) [デフォルト=N] ?Y
新バージョンの設定ファイル /etc/zabbix/zabbix_server.conf をインストールしています ...
zabbix-agent (1:6.0.29-1+ubuntu18.04) を設定しています ...
新バージョンの設定ファイル /etc/init.d/zabbix-agent をインストールしています ...
<中略>
*** zabbix_agentd.conf (Y/I/N/O/D/Z) [デフォルト=N] ?Y
新バージョンの設定ファイル /etc/zabbix/zabbix_agentd.conf をインストールしています ...
man-db (2.8.3-2ubuntu0.1) のトリガを処理しています ...
ureadahead (0.100.0-21) のトリガを処理しています ...
libc-bin (2.27-3ubuntu1.5) のトリガを処理しています ...
systemd (237-3ubuntu10.57) のトリガを処理しています ...
<省略>

Webフロントエンド(apache)関連ファイルを更新

sudo apt-get install zabbix-apache-conf

定義ファイルの修正

sudo vi /etc/zabbix/zabbix_server.conf
#129
# DBPassword= ↓
DBPassword=MySQLパスワード

ZABBIXサーバを再起動

sudo service zabbix-server stop
sudo service zabbix-server start

DBの更新状況を確認

sudo cat /var/log/zabbix/zabbix_server.log | grep database
MySQLの更新でエラーが発生
  9643:20240501:170922.020 current database version (mandatory/optional): 05000000/05000002
  9643:20240501:170922.035 starting automatic database upgrade
  9643:20240501:170922.103 completed 0% of database upgrade
  9643:20240501:170922.292 completed 1% of database upgrade
  9643:20240501:170922.522 completed 2% of database upgrade
  9643:20240501:170922.753 completed 3% of database upgrade
<中略>
  9643:20240501:171004.480 completed 89% of database upgrade
  9643:20240501:171004.521 completed 90% of database upgrade
  9643:20240501:171004.567 completed 91% of database upgrade
  9643:20240501:171005.010 completed 92% of database upgrade
  9643:20240501:171005.117 database upgrade failed on patch 06000011, exiting in 10 seconds
  9643:20240501:171015.128 database could be upgraded to use primary keys in history tables
  9717:20240501:171025.429 current database version (mandatory/optional): 06000000/06000010
  9717:20240501:171025.450 starting automatic database upgrade
  9717:20240501:171025.464 database upgrade failed on patch 06000011, exiting in 10 seconds
  9717:20240501:171035.469 database could be upgraded to use primary keys in history tables
  9758:20240501:171045.672 current database version (mandatory/optional): 06000000/06000010
  9758:20240501:171045.689 starting automatic database upgrade
  9758:20240501:171045.703 database upgrade failed on patch 06000011, exiting in 10 seconds
  9758:20240501:171055.714 database could be upgraded to use primary keys in history tables
  9795:20240501:171105.939 current database version (mandatory/optional): 06000000/06000010
  9795:20240501:171105.957 starting automatic database upgrade
  9795:20240501:171105.971 database upgrade failed on patch 06000011, exiting in 10 seconds
  9795:20240501:171115.982 database could be upgraded to use primary keys in history tables
  9829:20240501:171126.174 current database version (mandatory/optional): 06000000/06000010
  9829:20240501:171126.193 starting automatic database upgrade
  9829:20240501:171126.206 database upgrade failed on patch 06000011, exiting in 10 seconds
  9829:20240501:171136.211 database could be upgraded to use primary keys in history tables
  9881:20240501:171146.422 current database version (mandatory/optional): 06000000/06000010
  9881:20240501:171146.443 starting automatic database upgrade
  9881:20240501:171146.461 database upgrade failed on patch 06000011, exiting in 10 seconds
  9881:20240501:171156.471 database could be upgraded to use primary keys in history tables
  9917:20240501:171206.667 current database version (mandatory/optional): 06000000/06000010
  9917:20240501:171206.684 starting automatic database upgrade
  9917:20240501:171206.696 database upgrade failed on patch 06000011, exiting in 10 seconds
  9917:20240501:171216.702 database could be upgraded to use primary keys in history tables
  9957:20240501:171226.932 current database version (mandatory/optional): 06000000/06000010
  9957:20240501:171226.953 starting automatic database upgrade
  9957:20240501:171226.967 database upgrade failed on patch 06000011, exiting in 10 seconds
  9957:20240501:171236.976 database could be upgraded to use primary keys in history tables
<省略>

下記のサイトを参考に、MySQLのエラー対応を行いました

mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 499428
Server version: 8.0.22 MySQL Community Server - GPL

Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> SHOW VARIABLES LIKE 'log_bin_trust_function_creators';
+---------------------------------+-------+
| Variable_name                   | Value |
+---------------------------------+-------+
| log_bin_trust_function_creators | OFF   |
+---------------------------------+-------+
1 row in set (0.00 sec)

mysql> SET GLOBAL log_bin_trust_function_creators = 1;
Query OK, 0 rows affected (0.00 sec)

mysql> SHOW VARIABLES LIKE 'log_bin_trust_function_creators';
+---------------------------------+-------+
| Variable_name                   | Value |
+---------------------------------+-------+
| log_bin_trust_function_creators | ON    |
+---------------------------------+-------+
1 row in set (0.00 sec)

mysql>exit
Bye

再度DBの更新状況を確認

sudo cat /var/log/zabbix/zabbix_server.log | grep database
 10701:20240501:171831.442 starting automatic database upgrade
 10701:20240501:171831.464 completed 2% of database upgrade
 10701:20240501:171831.489 completed 5% of database upgrade
 10701:20240501:171831.600 completed 8% of database upgrade
 10701:20240501:171831.778 completed 11% of database upgrade
 10701:20240501:171832.795 completed 14% of database upgrade
 10701:20240501:171832.819 completed 17% of database upgrade
 10701:20240501:171832.847 completed 20% of database upgrade
 10701:20240501:171832.927 completed 23% of database upgrade
 10701:20240501:171832.969 completed 26% of database upgrade
 10701:20240501:171833.020 completed 29% of database upgrade
 10701:20240501:171833.076 completed 32% of database upgrade
 10701:20240501:171833.113 completed 35% of database upgrade
 10701:20240501:171833.148 completed 38% of database upgrade
 10701:20240501:171833.199 completed 41% of database upgrade
 10701:20240501:171833.246 completed 44% of database upgrade
 10701:20240501:171833.302 completed 47% of database upgrade
 10701:20240501:171833.354 completed 50% of database upgrade
 10701:20240501:171833.486 completed 52% of database upgrade
 10701:20240501:171833.534 completed 55% of database upgrade
 10701:20240501:171833.596 completed 58% of database upgrade
 10701:20240501:171833.647 completed 61% of database upgrade
 10701:20240501:171833.694 completed 64% of database upgrade
 10701:20240501:171833.733 completed 67% of database upgrade
 10701:20240501:171833.782 completed 70% of database upgrade
 10701:20240501:171833.840 completed 73% of database upgrade
 10701:20240501:171833.940 completed 76% of database upgrade
 10701:20240501:171833.998 completed 79% of database upgrade
 10701:20240501:171834.046 completed 82% of database upgrade
 10701:20240501:171834.098 completed 85% of database upgrade
 10701:20240501:171834.147 completed 88% of database upgrade
 10701:20240501:171834.195 completed 91% of database upgrade
 10701:20240501:171834.287 completed 94% of database upgrade
 10701:20240501:171834.390 completed 97% of database upgrade
 10701:20240501:171834.416 completed 100% of database upgrade
 10701:20240501:171834.421 database upgrade fully completed
 10701:20240501:171834.431 database could be upgraded to use primary keys in history tables
<省略>

ZABBIXサーバのバージョンが6.0にアップデートされた事を確認

zabbix_server -V
zabbix_server (Zabbix) 6.0.29

後処理

定義ファイル(zabbix_server.conf、zabbix_agentd.conf)の修正を実施

ZABBIXサーバを再起動

sudo service zabbix-server stop
sudo service zabbix-server start

ZABBIXエージェントを再起動

sudo service zabbix-agent stop
sudo service zabbix-agent start

zabbix_server.log及びzabbix_agentd.logで設定漏れに起因するエラーが出ていない事を目視して作業終了。

作業を終えて

バージョンアップの際は毎回何かしらのエラーが発生しますが、その度に対処方を公開して下さっている方々に助けられています。感謝致します。
既に7.0のLTSも公開されているのでそちらはいずれ行います。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?