0
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Ubuntu18.04をZabbix5.4にアップグレードするとDatabase errorで失敗する

0
Last updated at Posted at 2021-05-20

久しぶりにZabbixのバージョンアップ時にエラーが出て焦りました。気軽にバージョンを上げて解決に悩んで2時間程消耗したので、誰かの助けになれば幸いです。

環境

  • Ubuntu 18.04.5 LTS
  • Zabbix 5.2 -> 5.4

現象

公式のアップグレード手順通りに行ったのだが、Database errorが表示され正常にアップグレードできない。

スクリーンショット 2021-05-20 10.21.30.png

確認

[Z3005] query failed: [1832] Cannot change column 'scriptid'という感じでQueryが通らずアップグレードが失敗している。

/var/log/zabbix/zabbix_server.log

 1756:20210520:101837.080 database upgrade failed
  1759:20210520:101847.314 Starting Zabbix Server. Zabbix 5.4.0 (revision 5059e20a75).
...
  1759:20210520:101847.315 using configuration file: /etc/zabbix/zabbix_server.conf
  1759:20210520:101847.325 Unsupported DB! MariaDB version is 50505 which is smaller than minimum of 100037
  1759:20210520:101847.326 current database version (mandatory/optional): 05030069/05030069
  1759:20210520:101847.326 required mandatory version: 05040000
  1759:20210520:101847.326 starting automatic database upgrade
  1759:20210520:101847.327 [Z3005] query failed: [1832] Cannot change column 'scriptid': used in a foreign key constraint 'c_opcommand_2' [alter table opcommand modify `scriptid` bigint unsigned not null]
  1759:20210520:101847.327 database upgrade failed

解決方法

Query失敗で不正データがあるのかと思って1時間程悩み戻しも検討するが、Databaseのバージョンの問題との事

1759:20210520:101847.325 Unsupported DB! MariaDB version is 50505 which is smaller than minimum of 100037

たしかに...。普通にupgradeしても自動ではMariaDBのバージョンはそれ以上上がらないようなので、という事でサービスを停止後に10.5を明示してインストールを実行

# sudo service zabbix-server stop
# sudo apt-get install mariadb-server-10.5
# sudo service zabbix-server start

それでも動かない場合 (Row size too large)

さらに、Row size too largeが出たので設定変更を行います。
(※すでに前バージョンで設定済で上書きしなければ問題無い可能性有り)

/var/log/zabbix/zabbix_server.log
....

  3446:20210520:102323.335 [Z3005] query failed: [1118] Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. This includes storage overhead, check the manual. You have to change some columns to TEXT or BLOBs [alter table `config` add `url` varchar(255) default '' not null]

my.cnfやmariadb.cnfにinnodb_strict_mode=0を追加します。

/etc/mysql/mariadb.conf.d/50-server.cnf
[mysqld]
innodb_strict_mode=0

参考:

0
2
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
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?