千家信息网

升级zabbix到3.2.1报数据库升级失败的错误

发表于:2024-09-30 作者:千家信息网编辑
千家信息网最后更新 2024年09月30日,一 问题描述今天把zabbix server和zabbix proxy升级到3.2.1。先停掉zabbix server然后挨个升级zabbix proxy最后再升级zabbix server。zab
千家信息网最后更新 2024年09月30日升级zabbix到3.2.1报数据库升级失败的错误

一 问题描述

今天把zabbix server和zabbix proxy升级到3.2.1。先停掉zabbix server然后挨个升级zabbix proxy最后再升级zabbix server。zabbix proxy升级的时候没有错误,可以顺利进行。但是升级zabbix server的时候报出以下错误:

  4250:20161010:001506.980 using configuration file: /opt/app/zabbix/conf/zabbix_server.conf  4250:20161010:001506.998 current database version (mandatory/optional): 03000000/03000000  4250:20161010:001506.998 required mandatory version: 03020000  4250:20161010:001506.998 starting automatic database upgrade  4250:20161010:001507.010 [Z3005] query failed: [1091] Can't DROP 'history_log_2'; check that column/key exists [drop index history_log_2 on history_log]  4250:20161010:001507.011 database upgrade failed

之前是对zabbix的数据库做过表分区


二 问题解决

查看zabbix问题反馈是由于zabbix 3.2在升级的时候需要drop history_log_2这个索引,如果没有就会报错。



DROP TABLE history_log;DROP TABLE history_text;CREATE TABLE `history_log` (`id` BIGINT(20) UNSIGNED NOT NULL,`itemid` BIGINT(20) UNSIGNED NOT NULL,`clock` INT(11) NOT NULL DEFAULT '0',`timestamp` INT(11) NOT NULL DEFAULT '0',`source` VARCHAR(64) NOT NULL DEFAULT '' COLLATE 'utf8_bin',`severity` INT(11) NOT NULL DEFAULT '0',`value` TEXT NOT NULL COLLATE 'utf8_bin',`logeventid` INT(11) NOT NULL DEFAULT '0',`ns` INT(11) NOT NULL DEFAULT '0',PRIMARY KEY (`id`),UNIQUE INDEX `history_log_2` (`itemid`, `id`),INDEX `history_log_1` (`itemid`, `clock`))COLLATE='utf8_bin'ENGINE=InnoDB;CREATE TABLE `history_text` (`id` BIGINT(20) UNSIGNED NOT NULL,`itemid` BIGINT(20) UNSIGNED NOT NULL,`clock` INT(11) NOT NULL DEFAULT '0',`timestamp` INT(11) NOT NULL DEFAULT '0',`source` VARCHAR(64) NOT NULL DEFAULT '' COLLATE 'utf8_bin',`severity` INT(11) NOT NULL DEFAULT '0',`value` TEXT NOT NULL COLLATE 'utf8_bin',`logeventid` INT(11) NOT NULL DEFAULT '0',`ns` INT(11) NOT NULL DEFAULT '0',PRIMARY KEY (`id`),UNIQUE INDEX `history_text_2` (`itemid`, `id`),INDEX `history_text_1` (`itemid`, `clock`))COLLATE='utf8_bin'ENGINE=InnoDB;



升级完成以后,由于history_text和history_log重新创建了,原来的分区脚本不能直接对这两个表分区

需要先手动分区后脚本才能使用

http://john88wang.blog.51cto.com/2165294/1771557


参考文档:

http://john88wang.blog.51cto.com/2165294/1771082

https://zabbix.com/forum/showthread.php?p=189543

https://support.zabbix.com/browse/ZBX-11203



0